Converting a TIFF image to a JPEG image

Image format conversion is a part of nearly every geospatial project. Rasters come in dozens of different specialized formats, making conversion to a more common format a necessity. The GDAL utilities include a tool called gdal_translate specifically for format conversion. Unfortunately, the algorithm in the Processing Toolbox is limited in functionality. For format conversion, it is easier to use the core GDAL API.

Getting ready

We will use the SatImage raster available at https://github.com/GeospatialPython/Learn/raw/master/SatImage.zip.

Place this raster in your /qgis_data/rasters directory.

How to do it...

In this recipe, we'll open a TIFF image using GDAL and copy it to a new dataset as a JPEG2000 image, ...

Get QGIS Python Programming Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.