[gdal-dev] translating palettes in geotiff

Jukka Rahkonen jukka.rahkonen at mmmtike.fi
Tue Apr 23 13:12:14 PDT 2013


David Strip <gdal <at> stripfamily.net> writes:

> 
> I have a paletted geotiff that I want to modify by mapping palette 
> entries to a new palette.
> Thus, I have an input palette, an output palette, and a geotiff.  I have 
> a mapping (many to 1, if it matters) from the input palette to the 
> output palette. Each pixel in the output geotiff will have a value 
> equivalent to mapping the input geotiff's pixel value through the map.
> 
> I've looked over the utilities and none seems to have this capability. 
> It would be pretty easy, I think to write code using gdal to do this, 
> but if one of the utilities will handle this case, that's even better.
> 
> Thanks.

Hi,

Try gdal_translate. Write your paletted image into .vrt file, open and edit
the palette with text editor and convert the modified .vrt file into a new
geotiff.

rgb2pct.py utility http://www.gdal.org/rgb2pct.html is doing kind of similar
thing with the -pct option.

-Jukka Rahkonen-
 






More information about the gdal-dev mailing list