[gdal-dev] getcolortable is null

Frank Warmerdam warmerdam at pobox.com
Thu Apr 8 08:24:23 EDT 2010


weixj2003ld wrote:
> Thk u for your detail reply.
> 1.Now,I have a DEM(.img) file,and its band number is 1.When I use 
> 'gdal_translate  -b 1 -of  PNG old.img new.png' to create a png file(I 
> think its contains height map infomation,is it?).the error 'Warning 
> 6:PNG driver doesn't support data type Int16.Only eight bit<Byte>' and 
> sixteen bit<Uint16> bands supported.Defaulting to Byte.

Wei,

I would suggest converting to the supported type.

eg.

gdal_translate -of PNG -b 1 -ot UInt16 old.img new .png

> 2.When I use 'gdal_translate -b 1 -of JPEG old.img new.jpg',the error 
> 'JPEG doesn't support data type Int16. Only eight and twelve bit bands 
> supported<Mk1 libjepg>'

Depending on your intentions, it might be appropriate to rescale the
DEM data to 8bit forvisualization purposes.

gdal_translate -scale -ot Byte -of JPEG -b 1 old.img  new.jpg

I would encourage you to spend a bit more time reading over the commandline
options documentation for gdal_translate.

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