0

I'm hitting an issue with compression artefacts in GeoTIFFs specifically around the clipped edges.

The source GeoTIFFs are anything from 20Mb to 300Mb or larger. I've been recommended to follow this guide and I am pretty happy with the image quality (aside from the edge artefacts) and reduction of the file size to something more suitable for the web. The resulting layer loads fast via WMS and has no distinguishable loss of quality which seemed impressive since JPEG is lossy. In the final output, I wish to clip the GeoTIFF to a 500m buffer and hide the area outside of the buffer. The buffer shape is always non-rectangular. However, the JPEG compression seems to introduce artefacts around the edge:

edge artefacts

The current process goes like this:

  1. Using ArcMap, export raster data with the settings below. Note the 255 NoData which sets the area outside of the clip to transparent.

ArcMap

  1. On the resulting clipped GeoTIFF, run the following GDAL command which a) internally tiles and compresses with JPEG and b) changes the colour map to YCBCR (only applies to 3 band images). These are the recommendations for preparing aerial photography for WMS.

C:\Program Files (x86)\GDAL>gdal_translate -co TILED=YES -co COMPRESS=JPEG -co PHOTOMETRIC=YCBCR Aerial_1994.tif New_Aerial_1994.tif

Input file size is 5521, 5361 0...10...20...30...40...50...60...70...80...90...100 - done.

This takes Aerial_1994.tif (89Mb) and creates New_Aerial_1994.tif (5Mb).

I'm curious if others have come across this particular issue and if so, what solutions worked. My goals is to reduce or eliminate these edge artefacts. I'm now looking at GeoServer solutions including footprints and masking. I've also started looking at further data transformation via "Nearblack".

3
  • 2
    Don't use JPEG compression on an image with nodata values, use deflate or LZW. JPEG is a lossy compression method so the values aren't exact which leads to a greater capability of compression so on your edges the values can be anywhere from 250-255 with only the pixels exactly equal to 255 being nodata; If you absolutely must use JPEG compression you will need an opacity mask to enforce nodata (RGBA). On an aside why are you using YCBCR? The input is likely to be either RGB or RGBA, is there a reason to change the colourspace? Commented Sep 10, 2021 at 5:19
  • 1
    Images like aerial images compress much better as YCBCR than as RGB. The difference in compressed file size is typically around 20 percent.
    – user30184
    Commented Sep 10, 2021 at 5:27
  • Thanks folks. Ultimately the GeoTIFF needs to look good in desktop GIS systems as well as on a WMS so need to avoid server side solutions which I think the opacity mask is? I experimented with reduced JPEG compression (95 instead of the default 75) which reduced the appearance of the edge artefacts a little but it's still subpar especially when viewed with a satellite base map. I'll try a lossless algorithm as you suggest Michael which also means no benefit in changing the colourspace.
    – Neil
    Commented Sep 17, 2021 at 3:02

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.