[GIS] Performing gdal translate to png/jpeg

.jpggdalgdal-translatejpeg 2000png

I tried gdal translate to png:

gdal_translate image.bsq image.jpg -of JPEG -outsize 10% 10% -scale

enter image description here

and jpeg:

gdal_translate image.bsq image.png -of PNG -outsize 10% 10% -scale

enter image description here

jpeg looks better and file size is smaller. In general should I expect poor result with png?

Using the -r cubic and bilinear are almost the same to my eyes:

enter image description here

Best Answer

PNG should just about always produce a better result than JPG, because PNG is not lossy while JPG is - an important point for anything you're going to do any analysis or computation on. I suspect there's something going on with the interpolation method used as GDAL scales your raster. As the documentation says, the default resampling method (i.e., the -r flag you can specify) is nearest neighbor, which is best for classified or nominal data, but known to make poor products on photograph-like images, or statistical vector surfaces like DEMs. Try re-doing it to PNG, with -r bilinear or -r cubic.

Related Question