[Gdal-dev] gdal_merge.py Gtiff files with -pct losing color

Frank Warmerdam warmerdam at pobox.com
Thu Dec 7 14:07:31 EST 2006


Matt Wilkie wrote:
> Hi Dori, gdal doesn't like something about the way the source image[1] 
> is formatted. I can't view it in OpenEV or in QGIS, it just comes up as 
> a black image even before trying to translate or merge. Histograms in 
> both programs come up blank.  You should probably file a bug[2]
> 
> In the meantime, I was able to open the image using ossim 
> imagelinker[3], so maybe give that a try (though being pressed for time 
> you may not have the time to learn it).
> 
> 
> [1] 
> http://www.mediamax.com/izzybitsie/Hosted/AS_GMSNO_00_20061122205548.tif.gz
> [2] http://bugzilla.remotesensing.org/enter_bug.cgi?product=GDAL
> [3] http://www.ossim.org/OSSIM/Welcome.html

folks,

I'm afraid I lost track of this thread.  I have now fetched the file and
inspected it.  TIFF colors maps are supposed to have colors in the
range 0-65535 for each component instead of the usual 0-255 in other
formats.  It seems that this file has been incorrectly generated to
have the colormap between 0 and 255.  So when GDAL converts it to
0-255 values (roughly by dividing by 256) everything ends up black.

So, the input files are screwed up.

Any programs that ignore colormaps will just treat the images as
greyscale.

I also think this may be a fairly common failure with tiff generators
and that some applications may have special logic to look for files
with all colormap values in the 0-255 range and avoid the rescaling
that should happen.

Dori - if you want to file a bug in the GDAL bugzilla (Matt provided
the link above) for this problem, I'll try and implement a "hack" so
that these PCTs work properly.  It would be nice to get this in place
in time for beta2.

Best regards,
-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | President OSGeo, http://osgeo.org




More information about the Gdal-dev mailing list