[gdal-dev] Can GDALCreate be Used for PNG?

Nik Sands nixanz at nixanz.com
Tue Jul 16 22:14:10 PDT 2013


Can I use GDALCreate to create (and later write to) PNG images?
If so, is "PNG" the correct string for GDALGetDriverByName?

Otherwise, can somebody please let me know why the code below returns NULL from GDALCreate (assigned to dstDS)?

Advice much appreciated, as always.

Thanks,
Nik.



	GDALDriverH hDriver = GDALGetDriverByName("PNG");
	char **papszOptions = NULL;
	
	papszOptions = CSLSetNameValue( papszOptions, "WORLDFILE", "NO" );
	papszOptions = CSLSetNameValue( papszOptions, "ZLEVEL", "9" );
	
	GDALDatasetH dstDS = GDALCreate( hDriver, "/var/tmp/image.png", 256, 256, 4, GDT_Float32, papszOptions );


More information about the gdal-dev mailing list