[gdal-dev] Can GDAL open binary buffer contents as input for MEM
format?
Frank Warmerdam
warmerdam at pobox.com
Sat Jan 16 17:34:30 EST 2010
Roger André wrote:
> Hi Frank,
>
> Thanks for the example. How can I specify alpha in that, for one of the
> quantized 8-bit PNG's (with alpha) that MapServer produces?
Roger,
In a way this is simplier. It is just a one band GDT_Byte file, so more
like the first example I gave. The palette can be handled separately,
and assigned to the MEM dataset a bit like:
gdaltest.test_ct_data = [ (255,0,0), (0,255,0), (0,0,255), (255,255,255,0)]
gdaltest.test_ct = gdal.ColorTable()
for i in range(len(gdaltest.test_ct_data)):
gdaltest.test_ct.SetColorEntry( i, gdaltest.test_ct_data[i] )
mem_ds.GetRasterBand(1).SetColorTable( gdaltest.test_ct )
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 | Geospatial Programmer for Rent
More information about the gdal-dev
mailing list