[gdal-dev] Does everything have to be separated into bands?

Even Rouault even.rouault at mines-paris.org
Wed Sep 30 18:18:33 EDT 2009

Selon tasmith3 at rockwellcollins.com:

GDAL can also read at the dataset level. Look at the GDALRasterIO() /
GDALDataset::RasterIO() call. By adjusting the nPixelSpace, nLineSpace and
nBandSpace values, you can fill a pixel-interleaved buffer, or a
line-interleaved buffer or a band-interleaved buffer, deal with row striding,

For a pixel-interleaved RGB buffer, nPixelSpace = 3 (provided that you operate
on Byte samples), nLineSpace = 3 * buffer_width, nBandSpace = 1

> Hi there,
> I am working on software that takes geospatial imagery (usually GeoTIFFs)
> and converts it into textures that are used in our rendering engine.  The
> application also takes terrain files and generates terrain geometry.
> When we process our imagery (RGB), we want to do so on a per pixel basis.
> This means that I don't want to deal with individual color channels, but
> rather the simple RGB buffer itself - much like what the tiff/geotiff
> library gives when calling TIFFReadEncodedTile or TIFFReadEncodedStrip for
> example.  We've only been using the tiff/geotiff libraries up till this
> point, but we need to be able to handle other source file formats too and
> GDAL seemed like it might be the way to go.  The problem is though, that
> if I'm forced to divide my input data into different bands, that's not
> going to work.
> Is there a way to get GDAL to give me a buffer of raw pixel data without
> it being separated into individual bands?
> If the answer to that question is yes... I'll have some additional
> questions
> Thanks,
> Todd

More information about the gdal-dev mailing list