[gdal-dev] how to preserve color-interpretation when merging TIFFs and adding alpha band with gdalbuildvrt+gdalwarp?

Even Rouault even.rouault at spatialys.com
Tue Mar 27 06:41:09 PDT 2018


On mardi 27 mars 2018 15:11:31 CEST Raphael Das Gupta wrote:
> https://gis.stackexchange.com/q/274775/51574

If you use latest GDAL 2.2.4, you don't even need to add -setci to gdalwarp
The fact that the resulting raster doesn't display well by default with QGIS 
2.18 (actually I also find it to be the case with a QGIS 3 dev version) is 
just a small glitch of QGIS itself that doesn't recognize by default a file 
with a band with a color palette and an alpha band, but the file itself is 
just fine. Please file a QGIS ticket for that.

Regarding the palette having 256 entries rather than 2, this is a feature of 
the TIFF format itself. When you add the alpha band, we need 8 bit depth, so 
the color table has 256 entries. If you didn't need an alpha band, then adding 
-co NBITS=1 would have recreated a 1-bit depth file.

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com


More information about the gdal-dev mailing list