[gdal-dev] GDALCreateCopy from MEM Driver
Robert Zermeno
refriguy68 at yahoo.com
Wed Nov 21 11:49:28 PST 2012
GDAL community,
Is is plausible to contain a RGB image array (as pixel interleaved, rgbrgbrgbrgb) in a single MEMRasterBand to generate a color file via GDALCreateCopy()?
My application performs the following sequence:
1. Read a color image into an image buffer in pixel interleaved (rgbrgbrgb) format.
2. Setup MEM Driver to contain the recently read in image from step 1 above via AddBand().
3. Call GDALCreateCopy() on the specific output of my desire.
I have a question on Step 2 above (AddBand()). Do I have to create 3 seperate bands to contain individual color component? That would mean I have to take my RGB image buffer and seperate it into three new arrays of size (imageWidth * imageHeight) and call AddBands() on each one.
I am trying to adviod that step as I find it as an extra step. However, I understand if I have to because for a given color image GDAL always represents the file with 3 or 4 bands.
My answer is I will probably have to. My application can write out a valid file, but the resulting file is in Greyscale.
Robert
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20121121/ead11137/attachment.html>
More information about the gdal-dev
mailing list