I would like to work with the gdal functions provided in the processing toolbox. It is easy to call:

import processing

as an example. unfortunately I need jpg in the ouput or png. Is there any reason why I cannot save as jpg. I can use the warp or translate function in the GDAL toolbox with a jpg but it is hard for me to call it from within python.

Back to the question: Is there a support for jpg in the GDAL processing functions in QGIS?

  • No sure answers, but here's some info from the gdal website: gdal.org/frmt_jpeg.html
    – msayler
    Jul 2, 2014 at 23:11
  • If the source file has transparency, it can not be saved in JPEG format, because jpeg does not support that.
    – AndreJ
    Jul 3, 2014 at 6:18
  • @AndreJoost but the gdaltools can handle it...weird
    – Riccardo
    Jul 3, 2014 at 13:58

1 Answer 1


No, as JPG does not support the GDAL create option but only GDAL create copy: you can check it using this code:

from osgeo import gdal
format = "Jpeg"
driver = gdal.GetDriverByName( format )
metadata = driver.GetMetadata()
if metadata.has_key(gdal.DCAP_CREATE) and metadata[gdal.DCAP_CREATE] == 'YES':
    print 'Driver %s supports Create() method.' % format
if metadata.has_key(gdal.DCAP_CREATECOPY) and metadata[gdal.DCAP_CREATECOPY] == 'YES':
    print 'Driver %s supports CreateCopy() method.' % format

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.