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.
-
1Hi 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?– RafDouglas C. TommasiSep 16, 2022 at 13:41
-
3Just 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.– VinceSep 16, 2022 at 13:58
-
4You 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.– user30184Sep 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.– Vyacheslav KostrominSep 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"– Vyacheslav KostrominSep 19, 2022 at 5:40
Add a comment
|
1 Answer
gdal_translate -if GTiff -of JPEG input_file.tif output_file.jpg
-
1The
-if
option 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. 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 trygdal_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