Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#7152 closed defect (invalid)

Noise in nodata areas using gdal_translate with JPEG compression

Reported by: mattiassp Owned by: warmerdam
Priority: normal Milestone:
Component: GDAL_Raster Version: 2.2.1
Severity: normal Keywords: JPEG NoData gdal_translate
Cc:

Description

An uncompressed GeoTIFF (attached) generated with FME 17.1.1.1 (17652) is treated with gdal_translate for JPEG compression using:

gdal_translate.exe -co COMPRESS=JPEG "6504_120.tif" "6504_120_COMPRESSED.tif"

This results in nodata cells close to cells with data being filled with low data values which seem to be simple averages of the neighboring cells. See the attached image for an example of the kind of artefacts created.

I'm using gdal_translate built for QGIS 2.18.13, version 2.2.1 in Windows 7.

Attachments (2)

gdal_translate_jpeg_compression.zip (120.2 KB) - added by mattiassp 4 years ago.
Uncompressed and compressed GeoTIFF images and Windows batch file with the gdal_translate command used to compress the image.
Raster_artefacts.PNG (26.9 KB) - added by mattiassp 4 years ago.
Example of artefacts created in nodata areas close to cells with data when using gdal_translate with COMPRESS=JPEG

Download all attachments as: .zip

Change History (5)

Changed 4 years ago by mattiassp

Uncompressed and compressed GeoTIFF images and Windows batch file with the gdal_translate command used to compress the image.

Changed 4 years ago by mattiassp

Attachment: Raster_artefacts.PNG added

Example of artefacts created in nodata areas close to cells with data when using gdal_translate with COMPRESS=JPEG

comment:1 Changed 4 years ago by Jukka Rahkonen

What is the desired output? You probably know that JPEG is a lossy compression method and it is not possible that all zeros remains as zeroes after compression. There is even a GDAL utility made for handling that http://www.gdal.org/nearblack.html. It is still possible that your artefacts are worse than they need to be.

comment:2 Changed 4 years ago by Even Rouault

Resolution: invalid
Status: newclosed

As Jukka raised those artifacts are due to the JPEG compression/decompression. Nearblack is indeed the way to generate a mask to workaruond that

comment:3 Changed 4 years ago by mattiassp

Ah, I see! Thank you for the quick feedback and the Nearblack tip!

Note: See TracTickets for help on using tickets.