On Fri, Aug 14, 2009 at 9:21 AM, Henneke, Amanda M<[email protected]> wrote: > Hello all- > > I have a need to expand a 1 band palette tif file into a 3 band (rgb) tif > file. I have found that gdal_translate -expand rgb will do this from the > command line, but I was wondering if there was some way to do this within C# > using the GDAL bindings? I notice there is a ColorTable object and > PaletteInterpretation object, but I haven't figured out yet (or seen anything > online) about how to use these to expand the image.
Amanda, You could skim the gdal_translate code to see how -expand rgb works, but unfortunately it depends on access to VRT classes that are not directly callable from C# or other swig bindings. However, you can compose the corresponding VRT XML directly in C# and then "open" that VRT XML as a dataset that will have the expanded bands. This VRT dataset can then be passed to a CreateCopy() to write out the expanded result. I have attached the results of "gdal_translate -of VRT -expand rgb" on a dataset as an example of the corresponding XML. Best regards, -- ---------------------------------------+-------------------------------------- I set the clouds in motion - turn up | Frank Warmerdam, [email protected] light and sound - activate the windows | http://pobox.com/~warmerdam and watch the world go round - Rush | Geospatial Programmer for Rent
out.vrt
Description: Binary data
_______________________________________________ gdal-dev mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/gdal-dev
