It is pretty trivial to set the quality (and other) JPEG values. Here is a list of parameters one can set for the JPEG format. These parameters are simply passed to the CreateCopy() method as a list of options. Here's an example:
# ... Some other code ... #
if (cmp(output_file_ext.lower(),".jpg") == 0 or cmp(output_file_ext.lower(),".jpeg") == 0):
# Add options
options = []
options.append("QUALITY=90")
jpg_driver = gdal.GetDriverByName("JPEG")
# Pass options as parameter
jpg_driver.CreateCopy( output_file, dst_ds, options=options )
os.remove(output_file_tmp)
2 comments:
Thanks! This was just what I needed.
Hi can u tell me how can i convert other raster formats (like BIL) to GeoTIFF??
Post a Comment