[gdal-dev] Updated rgb2pct.py for greyscale images

Kreiser, Kevin kevin.kreiser at mapquest.com
Mon Jul 23 11:09:21 PDT 2012

I ran into a small limitation of rgb2pct.py when processing the http://www.glcf.umd.edu/data/landcover/data.shtml 1km AVHRR landcover data set. Essentially the data is structured such that there is a single color channel in which each pixel has a value between 0 - 14. Where 0 is water and 1-4 are forest etc.

At any rate, I needed a way to map those values to colors so I wanted to paletize the image. I of course tried rgb2pct.py but it only supported rgb images. So I set out to overcome this with a short hack to the script. I wasn't sure where to post this so I'm trying th is mailing list in case someone might want it in the repositor.

Anyway I've attached my modified version of the script to this post.

Thanks to the creators/contributers of gdal for these awesome resources!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120723/c1518b1f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rgb2pct.py
Type: text/x-python
Size: 5744 bytes
Desc: rgb2pct.py
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20120723/c1518b1f/attachment.py>

More information about the gdal-dev mailing list