You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/*! Types of color interpretation for raster bands. */
typedef enum
{
GCI_Undefined=0,
/*! Greyscale */ GCI_GrayIndex=1,
/*! Paletted (see associated color table) */ GCI_PaletteIndex=2,
/*! Red band of RGBA image */ GCI_RedBand=3,
/*! Green band of RGBA image */ GCI_GreenBand=4,
/*! Blue band of RGBA image */ GCI_BlueBand=5,
/*! Alpha (0=transparent, 255=opaque) */ GCI_AlphaBand=6,
/*! Hue band of HLS image */ GCI_HueBand=7,
/*! Saturation band of HLS image */ GCI_SaturationBand=8,
/*! Lightness band of HLS image */ GCI_LightnessBand=9,
/*! Cyan band of CMYK image */ GCI_CyanBand=10,
/*! Magenta band of CMYK image */ GCI_MagentaBand=11,
/*! Yellow band of CMYK image */ GCI_YellowBand=12,
/*! Black band of CMLY image */ GCI_BlackBand=13
} GDALColorInterp;
One way to implement this would be to add a colorinterp(bidx) method to the reader class and a set_colorinterp(bidx, value) method to the updater class. As with the existing tags(bidx) method.
SetColorInterpretation?() on the GTiff driver only really work on alpha bands. The color interpretation is dedecuded from the TIFF Photometric TAG, the presence of color table and the value of the ExtraSamples? tag.
Activity
kapadia commentedon Jul 2, 2014
I added a
colorinterpmethod to theRasterReaderandwrite_colorinterptoRasterUpdater. Tests are included, and I did a sanity check withgdalinfo:)kapadia commentedon Jul 2, 2014
For the enums, grey or gray?
sgillies commentedon Jul 2, 2014
👍 for both.
sgillies commentedon Jul 2, 2014
Merged. There's a quirk which might be GDAL's:
It looks like GDAL might be overriding the color interpretaton we provide. I'll dig and see what's up.
sgillies commentedon Jul 2, 2014
@kapadia check this out: https://trac.osgeo.org/gdal/ticket/4547
It looks like TIFF tags are the only way to update the color interpretation. I'm inclined to remove
write_colorinterp()and document how to use the photometric creation option for the GTiff format: http://www.gdal.org/frmt_gtiff.html.Remove write_colorinterp().
sgillies commentedon Jul 2, 2014
It looks like a photometric creation option is the only foolproof way to do it. Here's an example from the tests: