[gdal-dev] JPEG format.

Even Rouault even.rouault at mines-paris.org
Wed Jul 29 13:55:46 EDT 2009


Le Wednesday 29 July 2009 19:44:41 Belaid MOA, vous avez écrit :
> Hi Everyone,
>   When I try to use GDALCreate() on the JPEG driver, I got the following
> error: "GDALDriver::Create() ... no create method implemented for this
> format." Does is this mean that JPEG driver does not have its GDALCreate()
> function implemented?

Hum, I can admit that sometimes error messages are not particularly clear, but 
here .... !

> Any example on how to use JPEG driver is appreciated. 

The JPEG is no different from other drivers. The fact that the Create() method 
is not implemented just reflect the fact that you can't write data at random 
scanlines in a JPEG file, it must be created scanline by scanline, from top 
to bottom. So you want to use the CreateCopy() method instead. As a source 
raster for the CreateCopy(), you can use a dataset created with the MEM 
driver (that supports the Create() method), or any other disk-based format 
like GTIFF that supports the Create() method.

Schematically (in Python) :

mem_ds = gdal.GetDriverByName('MEM').Create(....)
mem_ds.WriteRaster(....)

jpeg_ds = gdal.GetDriverByName('JPEG').CreateCopy(mem_ds, "out.jpg")
jpeg_ds = None
mem_ds = None

>
>   As always, any help on this is very appreciated.
>
> With best regards.
> ~Belaid
>
> _________________________________________________________________
> Stay in the loop and chat with friends, right from your inbox!
> http://go.microsoft.com/?linkid=9671354




More information about the gdal-dev mailing list