Tuesday 21 May 2019

raster - GDAL TIF to JPG Creates Dark Image


I'm using the GDAL Raster>Translate to create JPGs from Georeferenced TIFs. The translation is working, but the resulting JPGs are significantly darker than the TIFs they are being created from.



Here is a screen shot showing the difference in brightness: enter image description here


Anyone know why this is happening and (more importantly) how I can fix it?


Thanks!



Answer



Downloaded the raster from your link and used GDAL_Translate from the command line and the image was awful.


Your source image is 32bit RGBA, JPEG does not support RGBA so I tried -b 1 -b 2 -b 3 to pluck out the RGB bands from the 32bit:


JPEG converted from tiff


the QGIS translator gives you the option to edit the command so insert -b 1 -b 2 -b 3 into this line and your JPEG images will be much better.


GDAL_TRANSLATE -OF JPEG -B 1 -B 2 -B 3 d:\path\image.tif d:\other_path\image.jpg

No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...