[Gdal-dev] Re: Changing colour in tif file

Matt Wilkie matt.wilkie at gov.yk.ca
Thu Nov 9 17:57:53 EST 2006


> I need to replace a value in three bands depending on a condition 
> spanning the three bands, e.g if RGB == 255,0,0 then RGB = 120,60,60 or 
> some such.

If you're lucky enough for the desired data to be a the top or bototm of 
the range you can use the scale command (need to split out the bands 
into separate files first):

	gdal_translate -b 1 rgb-image.tif red.tif
	gdal_translate -scale 0 255 0 254 red.tif ...

where 255 is the value to get rid of. The result unfortunately is not 
the same as converting 255 to nodata.

cheers,

-- 
matt wilkie
--------------------------------------------
Geographic Information,
Information Management and Technology,
Yukon Department of Environment
10 Burns Road * Whitehorse, Yukon * Y1A 4Y9
867-667-8133 Tel * 867-393-7003 Fax
http://environmentyukon.gov.yk.ca/geomatics/
--------------------------------------------




More information about the Gdal-dev mailing list