I want to develop a web portal that will show the images dynamically produced by QGIS, but QGIS provided tiff images are too big in size and it is not possible to show it on website using image viewers. That's why I have decided to convert those tiff images into jpg/jpeg to reduce in size as well as browser friendly so that I can show those images on my website easily. But I don't know how to convert tiff images into jpg/jpeg using gdal commands.

Please help me in this regard.

  • two questions: 1) do you want only to change(convert) the image type from tiff to jpg or do you also want to resize? 2)which operating system do you use?
    – Kurt
    Commented May 26, 2012 at 15:22
  • I also want to resize and I'm using ubuntu Commented May 26, 2012 at 17:13
  • If you have a WMS then the choice of format is determined by the the client, so a web client can request jpeg or png and a desktop GIS can select TIFF, and no need to convert yourself
    – nmtoken
    Commented Dec 10, 2017 at 18:42

2 Answers 2


try this with gdal:

gdal_translate -of JPEG -scale -co worldfile=yes input.tiff output.jpg

it also create worldfile too...

i hope it helps you...

  • thanks to those who commented on my post. Aragon your solution worked for me Commented May 26, 2012 at 17:22
  • one more thing how can I do it dynamically so that I can show the image on the website Commented May 26, 2012 at 17:42
  • If you keep getting solid black output, you might need to specify the min and max values for scale. I used gdalinfo to get the min and max, then provide them like ... -scale 0 0.158 ... Commented Jan 31, 2018 at 3:03
  • Good, but it discards any color information from the band rendering. Do you know how to keep it?
    – Rodrigo
    Commented Nov 7, 2019 at 13:41
  • Legend @aragon! Thank you for this solution. Was using imagemagic's convert, but it's not lossless, so the resulting jpg was losing some detail. But this seems only get the jpg data out of the tiff file, no recompression going on as far as I can see.
    – Mint
    Commented Sep 7, 2021 at 5:49


Choose Raster menu - Conversion - Translate (Convert format). Then choose *Input file* for the image You want to convert. Under the *Output file* You can choose the format You need. There is .jpg too (with some 20+ file types).

I got 40MB large .tiff file, after conversion its only 1,6 MB as .jpg.

  • 3
    Good, but it discards any color information from the band rendering. Do you know how to keep it?
    – Rodrigo
    Commented Nov 7, 2019 at 13:41
  • I use as input float32 RGB image .tif file and when I store it as .jpeg is totally black.... Why I get that result?
    – Steven
    Commented Jul 25, 2022 at 11:21

Your Answer

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

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