[gdal-dev] Reading/Interpreting multi band Tiffs

Tom Kazimiers 2voodoo at gmx.de
Wed Sep 24 04:08:13 EDT 2008

Frank Warmerdam schrieb:
> Tom Kazimiers wrote:
>>> There is also a RasterIO() method on the Dataset which allows
>>> fetching all the bands in one request.  In C++ this is:
>>> http://www.gdal.org/classGDALDataset.html#e077c53268d2272eebed10b891a05743
>> thank you very much - this was what I was looking for. Unfortunately I
>> need to write Data in the form Band3, Band2, Band1, Band3, Band2, Band1,
>> ... (BGR)
>> Like you have said, the reading is sequential and it was not very hard
>> to get it working with a result of the form Band1, Band2, Ban3, Band1,
>> Band2, Band3, ... (RGB)
>> Is there a way to change the order of the bands so that I can use this
>> function (alternatively I could write a fast switch function, sure - but
>> it would be nicer to have it all in one function)? With three seperate
>> calls to the per-raster-band-RasterIO I can controle everything pretty
>> good, but it seems that the per-dataset-RasterIO is faster (maybe
>> illusion :P).
> Tom,
> To read or write from a BGR buffer you can either passing the band
> list reversed (ie. panBandMap is {3,2,1}) or fudze with the
> pixelspace, linespace and bandspace values to simulate the reverse.
> Sometimes dataset level io will be faster but often it is internally
> implemented by calling band level io.
> Best regards,

Thank you very much, Frank. This works perfectly :)

Best regards,

More information about the gdal-dev mailing list