#3547 closed enhancement (fixed)
GTiff: support writing color map in two band byte (256 colour + alpha) images
Reported by: | maphew | Owned by: | Even Rouault |
---|---|---|---|
Priority: | normal | Milestone: | 1.8.0 |
Component: | GDAL_Raster | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: |
Description
Global Mapper can write 256 colour geotiff's with an alpha channel. Gdal_translate reads these okay but drops the colour map on conversion:
0Warning 1: Unable to export color table to GeoTIFF file. Color tables can only be written to 1 band Byte or UInt16 GeoTIFF files.
Attachments (3)
Change History (7)
by , 13 years ago
Attachment: | gm_cmap+alpha.tif added |
---|
by , 13 years ago
Attachment: | gm_cmap+alpha.gdalinfo.txt added |
---|
gdalinfo report on GM 2 band byte file with colour map and alpha
by , 13 years ago
Attachment: | gdal_outfile.tif added |
---|
gdal_translate -co compress=lzw "gm_cmap+alpha.tif" gdal_outfile.tif
comment:1 by , 13 years ago
Owner: | changed from | to
---|
comment:2 by , 13 years ago
Component: | Utilities → GDAL_Raster |
---|---|
Milestone: | → 1.8.0 |
Resolution: | → fixed |
Status: | new → closed |
Summary: | support color map in two band byte (256 colour + alpha) images → GTiff: support writing color map in two band byte (256 colour + alpha) images |
Fixed in trunk (r19517) and tested in r19518. I've also fixed gdal_translate -expand rgba on such datasets : it crashed previously. Now it takes the 3 components of the color table for R,G,B and copy the alpha channel of the source to the target.
I'd note this is a very unusual formulation of TIFF. I found this discussion on the libtiff mailing list - http://www.asmail.be/msg0055391721.html - where this is acknowledged. There's no technical obstacle to implement it with libtiff, but you should expect interoperability issues with many readers not ready for it. As you noted, GlobalMapper 11 supports it (but previous versions not). I've found that gimp could also read correctly such images (but cannot save them : 'TIFF save cannot handle indexed images with alpha channel.'). Most software will ignore the alpha band, such as OpenEV, the display utility from ImageMagick, Eye of Gnome, .... Latest version of QGis in osgeo4w is confused and displays the image with weird colors (it looks correct when only the 1st band is present)
comment:3 by , 13 years ago
wow, that was fast! and thorough too; I appreciate the high level overview of what other programs would do with such imagery. thanks :)
comment:4 by , 13 years ago
...and for anyone not running the development leading edge, I realized one can keep the colour map by dropping the second band, or vice versa:
gdal_translate "gm_cmap+alpha.tif" out.tif -b 1 gdal_translate "gm_cmap+alpha.tif" out-alpha.tif -b 2
Global Mapper 2 band byte file with colour map and alpha channel