1

I'm working a lot with GeoTIFF images, most of which have Senitnel-2 bands B02 (blue), B03 (green), B04 (red), B8A (NIR), B11 (SWIR) and B12 (SWIR) in that sequence. When I load them in QGIS, RGB display colors are mapped to B02, B03 and B04 respectively, i.e. blue and red are switched.

Is there a way to specify the default display band combination in GeoTIFF? (I'm writing with rasterio)

I'm aware that I can set the default band combination in QGIS but I consider that a suboptimal workaround as that would apply to all images and then when I encounter images where RGB is saved in that sequence, blue and red would be switched again.

1 Answer 1

2

I would create a GDAL VRT file with gdal_translate https://gdal.org/programs/gdal_translate.html.

gdal_translate -of VRT -b 3 -b 2 -b 1 sentinel2.tif sentinel2.vrt

When you now open the sentinel2.vrt file with QGIS the right bands are selected from the source image "sentinel2.tif" and re-ordered. The .vrt file is just a small XML file and the original GeoTIFF is not edited.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.