[gdal-dev] Mapping many external band types to a few internal formats

Charles Karney charles.karney at sri.com
Mon May 9 14:03:08 EDT 2011

How can I open a more-or-less arbitrary image file and have GDAL present
it to me (the programmer) in a "normalized" form?  I had thought that
the virtual datasets would allow me to do this.  But I can't tell how
from the tutorial.  Here are examples of what I've like to do:

On input

   Have color-mapped file look like RGB
   Convert file with nodata values to RGBA
   Convert RGB files to an RGBA file
   Convert gray files to RGB or RGBA
   Convert color files to gray
   Convert 16-bit files to 8 bit (according to some formula)
   Convert 16-bit files to float32 (with offset + scale)

On output (less important)

   Convert an RGBA image with an unused A channel (all opaque) to RGB
   Convert an Gray-alpha image to a Gray-nodata file (if there's an
     unused gray value)
   Convert RGB to color-mapped if the number colors is small enough.

Basically, I would like to be able to deal with only a few basic image
types within my program and have the mapping from the various external
data arrangements done "seamlessly" by the reader.

I had coded up much of this functionality with my on layer on top of
GDAL.  But this got really messy after a while.  I'm looking for a
better approach and would welcome any advice.

Charles Karney <charles.karney at sri.com>
SRI International, Princeton, NJ 08543-5300
Tel: +1 609 734 2312

More information about the gdal-dev mailing list