[gdal-dev] GDALColorInterp for PGM images?

Frank Warmerdam warmerdam at pobox.com
Wed Dec 5 11:11:32 EST 2007


Filip Rooms wrote:
> Dear list,
> 
> Could it be that a PGM image (Portable Grey Map, maybe not so suitable
> for geo applications) is not recognized to be a grey image?
> 
> GDALColorInterp is in my case  GCI_Undefined... For the rest, everything
> is imported and we can access the image and its values, just the band
> interpretation seems to be lost somehow.
> 
> The first lines of the image are plain text (as is expected: the magic
> number here indicating raw grey value, followed by the image dimensions
> and last the max pixel value in the image).
> 
> P5
> 660 660
> 255
> 
> I used GDAL 1.4.1. Did I miss something or do something else
> incorrectly? Thanks in advance.

Filip,

This is a deficiency of the PNM driver in GDAL, not a mistake in your use.
GCI_Undefined just means the color interpretation is not known.

I have just updated the PNM driver to set color interpretations on the bands
for greyscale or rgb images but there are still lots of formats that don't
or can't set meaningful color interpretations.

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    | President OSGeo, http://osgeo.org



More information about the gdal-dev mailing list