[gdal-dev] RGB to gray 8 bits JPEG

Marc Jacquin marc.jacquin at magellium.fr
Tue Jul 13 09:15:47 EDT 2010


Hi all again,

 

Using the GDAL CSharp binding, I am trying to convert RGB data from a
Dataset (MEM driver) to 8 bits gray scaled JPEG.

 

I create a ColorTable of GPI_Gray interpretation type and populate it with
CreateColorRamp with ColorEntries from 0,0,0 to 255,255,255.

I set the color interpretation for the new (MEM driver) dataset single band
to GCI_GrayIndex.

Then use DitherRGB2PCT and finally CreateCopy with the JPEG driver.

But the output remains empty (1 colour : 0,0,0).

 

I tried to figure out how gdal_translate may do it with the -expand gray
option but it uses a VRTSourcedRasterBand which does not seem to be
available in CSharp.

 

Thanks,

 

Marc

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20100713/915cd5e3/attachment-0001.html


More information about the gdal-dev mailing list