[gdal-dev] convert one band data in rgba
Kees Kling
ckling at upcmail.nl
Fri Nov 16 04:03:47 PST 2012
Hi,
I want to convert an indexed image to a rgba color image with help of a
colortable
so I created a GDALDataset
drv = (GDALDriver *) GDALGetDriverByName("MEM");
if (!drv) {
throw "Unable to register GDAL Memory Driver";
}
GDALDataset* tmpdata =
drv->Create("rawRadar",mysqlData.columns,mysqlData.rows,1,GDT_Byte,NULL);
// Added the colortable
CPLErr err = tmpdata->GetRasterBand(1)->SetColorTable(cTable);
// Inserted the data from a byte array
tmpdata->RasterIO(GF_Write,0,0,mysqlData.columns,mysqlData.rows,
(unsigned char
*)mysqlData.data.c_str(),mysqlData.columns,mysqlData.rows,
GDT_Byte,1, NULL, 0, 0,0);
From here on I'm stuck.
How do I go on to convert this data to a in memory GDALDataset with 4
channels (R,G,B,A)
Thanks
Kees Kling
More information about the gdal-dev
mailing list