[Gdal-dev] Is there a GetRasterBandasRGB?

Frank Warmerdam warmerdam at pobox.com
Wed Jul 5 10:08:43 EDT 2006


Christopher Barker wrote:
> Hi all,
> 
> I've been starting to work with GDAL (mostly with the python bindings), 
> and I've been very impressed, it's a very nice piece of work. I'm 
> particularly thrilled with the BSB support.
> 
> What I need to do is be able to read any (ideally) form of 
> geo-referenced raster image that GDAL supports, and then get a 24 bit 
> RGB version of a given subset of the image.
> 
> I've found I can use GetRasterBand() to extract the data I want. 
> However, I found myself having to write different versions of the code, 
> depending on how the data was stored:
> 
> if is is a single band raster, with a ColorTable, I do one thing
> 
> If it's a three band raster, with RBG bands, I do another
> 
> etc.....
> 
> Those are the two I've supported so far, but then it downed on me that 
> my needs can not be unique! this must be a pretty common problem.
> 
> So the question is, have I missed a function that extracts a subsection 
> of the rasterdata, and converts it to RGB data for me? If it's not built 
> in to GDAL, has anyone written such a thing, and/or would this be the 
> kind of thing that you'd like to add, if I write it?

Chris,

I'm afraid you have not missed a function.  You basically need to do this
yourself.

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    | President OSGF, http://osgeo.org




More information about the Gdal-dev mailing list