[Gdal-dev] Writing bit interleaved datawith GDALRasterBand::RasterIO

Frank Warmerdam warmerdam at pobox.com
Wed Jul 7 17:41:29 EDT 2004


Chapman, Martin wrote:
> Alain,
> 
> Thank you very much for the code, but I am trying to write a dib section
> out to a raster file rather than read into a dib section.  I was
> wondering if the rasterio() function could handle the data in pixel
> interleave versus band interleave.  That way I could just save contents
> from the dib section directly into the rasterio() function without
> having to take the extra time to reformat the interleaving to be band
> interleave.  Frank said that's what the nPixelSpace and nLineSpace
> params are for.  Do you have code that can do that? 

Martin,

The concern I had before was that you talked about "bit" interleaving
rather than byte or pixel interleaving.  I assume you meant byte interleaving
all along.

The calls I suggested before assume byte (pixel) interleaved data in RGB
format but normal top to bottom orientation.  I believe DIB's are bottom
to top and in BGR format.  For that you would need to either process one
scanline at a time, or properly account for the upsidedownness in the
nLineSpacing values and the offset into the image provided for whatever
y offset you are at.

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent




More information about the Gdal-dev mailing list