[Gdal-dev] gdal_translate: loses colour from GeoTIF to JPEG
Frank Warmerdam
fwarmerdam at gmail.com
Tue Jul 26 16:47:13 EDT 2005
On 7/26/05, Leibold, David <leibold at lsec.dnd.ca> wrote:
> I have a GeoTiff file (*.tif) which seems to be in order (colours seem to be OK, as is georeferencing when viewed on Tatuk viewer, or presumably other geo viewers).
>
> But when I converting TIF to JPEG:
>
> gdal_translate -of JPEG -co "WORLDFILE=YES" geo.tif geo2.jpg
>
> ... the geo2.jpg comes out all greyscale. It does open OK in Tatuk viewer with georeferencing (after renaming the world file extension from .wld to .jfw), apart from the black & white TV look.
>
> The GeoTiff file seems to have only one colour band, after running gdalinfo on it. The single band means -b 2, -b 3 flags wont' work.
>
> Any way to bring colour from Tif to JPG?
David,
You need to convert the image from pseudocolored format to 24bit
RGB. This can be accomplished wth the pct2rgb.py script.
eg.
pct2rgb.py original.tif rgb.tif
gdal_translate -of JPEG rgb.tif out.jpg -co WORLDFILE=YES
If you are using FWTools on windows, just invoke "rgb2pct" in
the shell. There is a "bat" script around the python script.
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