[gdal-dev] gdal_translate to get rid of 3th band:

Frank Warmerdam warmerdam at pobox.com
Fri Apr 10 11:41:38 EDT 2009


John Mitchell wrote:
> Hi,
> 
> When running gdal_translate to get rid of the 3th band of a 3 band RGB 
> geotiff image:
> 
> gdal_translate -b 1 -b 2 sourcefilename outputfilename
> 
> It got rid of the 3rd band but it made the first band gray and the 
> second band undefined which caused the new geotiff to be gray.
> 
> How can I keep the color of the first 2 bands when getting rid of the 
> 3rd band

John,

TIFF does not have a concept of per-band color interpretation so you
essentially need to pick RGB for a 3 band file or grayscale for a 1-2
band file.

There just isn't a proper way of expressing what you want in TIFF format.

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