[Gdal-dev] Writing bitinterleaved datawith GDALRasterBand::RasterIO

Chapman, Martin MChapman at sanz.com
Wed Jul 7 17:50:48 EDT 2004


Frank,

You are right, I said bit when I meant byte, sorry for the confusion.
You're also right about the BGR thing, I forgot about that.  I think it
will work then if I handle my offsets correctly and reverse the sign of
the y value.  I haven't tried it yet but when I do I'll let you know if
it works.  It would be a really slick way to save out DIB sections if it
works.  Otherwise, I will stop being lazy and repack my data correctly
before I save it.  Thanks for all the help everyone.

Martin

-----Original Message-----
From: Frank Warmerdam [mailto:warmerdam at pobox.com] 
Sent: Wednesday, July 07, 2004 3:41 PM
To: Chapman, Martin
Cc: gdal-dev
Subject: Re: [Gdal-dev] Writing bitinterleaved datawith
GDALRasterBand::RasterIO


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

_______________________________________________
Gdal-dev mailing list
Gdal-dev at xserve.flids.com
http://xserve.flids.com/mailman/listinfo/gdal-dev



More information about the Gdal-dev mailing list