[gdal-dev] getcolortable is null

Frank Warmerdam warmerdam at pobox.com
Wed Apr 7 07:27:51 EDT 2010

weixj2003ld wrote:
> I read a geotiff file, and find that
> poBand->GetColorTable()==NULL


Presumably GetColorTable() returns NULL because the GeoTIFF file
does not have a color table.

> But I use ERDAS IMAGINE9.2 (a software that deal with geotiff), I find 
> that it is not grey,but I use "gdal_translate -b 6 -of JPEG old.tif 
> net.jpg", find that is is grey.

Well, you are selecting only one band withouta color table to export
to net.jpg.  How do you expect it to be anything other than greyscale?
If you want an RGB jpeg file then select three bands to be used as
red, green and blue.

gdal_translate -b 4 -b 5 -b 6 o-of JPEG  old.tif net.jpg

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    | Geospatial Programmer for Rent

More information about the gdal-dev mailing list