0

I need to to write the right code to convert a huge TIFF to JPEG using GDAL. New with coding so it is hard to do alone.

5
  • 1
    Hi Vyacheslav and welcome to GIS.stackexchange! I assume the input TIFF file is a GeoTff? Also, do you need to preserve coordinates in the output JPEG? Sep 16, 2022 at 13:41
  • 3
    Just because the file is smaller doesn't mean it will automatically be easier to use. A compressed large dimension is still a large dimension image. JPEG is a lossy algorithm, so the values will be corrupted, and only certain data type and bit widths are supported. This is likely an XY Problem, so you should probably report the reason behind your goal.
    – Vince
    Sep 16, 2022 at 13:58
  • 4
    You cannot convert a huge TIFF into JPEG. The maximum size that the JPEG format supports is 4 GB and I would not call it huge.
    – user30184
    Sep 16, 2022 at 14:07
  • Hi! I have geotiff amd I need to keep koordinates in JPG. THe reason why I want to convert is that software that I use does not able to open 15 Gb geotiff. It has some limitations... I already slised it using QGIS and opened but want to learn how to convert using GDAL also. Sep 19, 2022 at 5:27
  • Translate function does not work in my case "Warning 1: 4-band JPEGs will be interpreted on reading as in CMYK colorspace ERROR 1: libjpeg: Maximum supported image dimension is 65500 pixels Process returned error code 1" Sep 19, 2022 at 5:40

1 Answer 1

2
gdal_translate -if GTiff -of JPEG input_file.tif output_file.jpg
5
  • 1
    The -ifoption was added in GDAL version 3.2 so older versions do not support it. Fortunately it is not necessary to use it, GDAL can usually recognize the input format automatically.
    – user30184
    Sep 16, 2022 at 14:10
  • Warning 1: 4-band JPEGs will be interpreted on reading as in CMYK colorspace ERROR 1: libjpeg: Maximum supported image dimension is 65500 pixels Process returned error code 1 Sep 19, 2022 at 5:41
  • Also it show me a syntax error even if I delet "if". Could you check it? gdal_translate -Tiff -of JPEG input_file.tif output_file.jpg Sep 19, 2022 at 5:46
  • Which syntax error do you receive? also, -Tiff is not a legal switch: maybe try gdal_translate -of JPEG input_file.tif output_file.jpg instead Sep 19, 2022 at 7:32
  • gdal_translate -of JPEG input_file.tif output_file.jpg ^ Seems that something with JPEG Sep 19, 2022 at 8:01

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.