[gdal-dev] core dumping on PNG RGB creation

Jared Rubin JARED.RUBIN at saic.com
Mon Feb 2 14:35:09 EST 2009


I am unable to generate a RGB png image from the python swig interface.
The following code does work if I change the driver to BMP. Is there
something odd about the PNG driver?
Thanks


import osgeo.gdal as gdal
import numpy
buf = (numpy.random.rand(100*100*3)*255).round() % 255
buf = buf.reshape(100,100,3)
driver = gdal.GetDriverByName('PNG')
ds = driver.Create('tmp.png',100,100,3)
ds.GetRasterBand(1).WriteArray(buf[:,:,0])
ds.GetRasterBand(2).WriteArray(buf[:,:,1])
ds.GetRasterBand(3).WriteArray(buf[:,:,2])





More information about the gdal-dev mailing list