Re: [gdal-dev] core dumping on PNG RGB creation
Lucena, Ivan
ivan.lucena at pmldnet.com
Mon Feb 2 15:05:42 EST 2009
That is because the PNG driver does not support Create() Method.
Compare the two outputs:
% gdalinfo --format png
% gdalinfo --format gtiff
> -------Original Message-------
> From: Jared Rubin <JARED.RUBIN at saic.com>
> Subject: [gdal-dev] core dumping on PNG RGB creation
> Sent: Feb 02 '09 19:35
>
> 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])
>
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
More information about the gdal-dev
mailing list