[gdal-dev] Colored images from grayscale images.

Even Rouault even.rouault at mines-paris.org
Wed Jul 8 14:48:08 EDT 2009


You don't need to change anything. It is just a matter of ("smart") 
configuration of the text file that maps from values to RGB triplets. For 
example if you want to associate (R1,G1,B1) to [0,0.1[, (R2,G2,B2) to [0.1, 
0.2[, etc ..., try this :

0                    R1 G1 B1
0.099999999 R1 G1 B1
0.1                 R2 G2 B2
0.199999999 R2 G2 B2


Le Wednesday 08 July 2009 20:43:56 Belaid MOA, vous avez écrit :
> Thanks a lot Even. I looked at the gdaldem doc and it seems it does some
> kind of blending to the image. Unfortunately, I do not want to produce any
> extra information/distortion in the image; only associate ranges to colors.
> The ranges form a partition of the pixel values. So, no
> interpolation/blending is needed. Is gdaldem easy to change to do this?
>
> With best regards.
> Belaid Moa.
>
> > From: even.rouault at mines-paris.org
> > To: gdal-dev at lists.osgeo.org
> > Subject: Re: [gdal-dev] Colored images from grayscale images.
> > Date: Wed, 8 Jul 2009 20:02:07 +0200
> > CC: belaid_moa at hotmail.com
> >
> > You might want to try gdaldem with the color-relief mode to associate RGB
> > values to pixel values. See http://gdal.org/gdaldem.html.
> >
> > But this will not set metadata. Otherwise you might want to try MapServer
> > if you want a nice looking map with a legend.
> >
> > Le Wednesday 08 July 2009 19:33:34 Belaid MOA, vous avez écrit :
> > > Hi everyone,
> > >   Is there any easy way to do the following using C++ in GDAL: I have a
> > > floating-point image and I'd like to associate arbitrary colors with
> > > ranges of the pixel levels. For example: for the pixel values in
> > > [0,0.1) associate red, for [0.1, 0.2) associated orange, for [0.2, 0.3)
> > > associate light blue, for [0.3,0.4) associate dark blue, for [0.4, 0.5)
> > > associate green, etc. I would like also to have this information
> > > available in the metadata or as legend so that users know what the
> > > colors stand for when they view the image.
> > >
> > >  Thanks a lot in advance for any input.
> > >
> > >  With best regards.
> > > Belaid Moa.
> > >
> > >
> > >
> > > _________________________________________________________________
> > > Create a cool, new character for your Windows Live™ Messenger.
> > > http://go.microsoft.com/?linkid=9656621
>
> _________________________________________________________________
> Attention all humans. We are your photos. Free us.
> http://go.microsoft.com/?linkid=9666046




More information about the gdal-dev mailing list