[gdal-dev] Black artifacts with JPEG compression
carsten.lockenkoetter at web.de
carsten.lockenkoetter at web.de
Tue May 27 12:21:37 PDT 2025
Hi all,
I would like to serve GeoTIFFs via GeoServer as WMS / WMTS.
Basically, this is not a problem, but the GeoTIFFs should use as little disk space as possible while still being very performant when accessed via WMS.
In the past, I worked with LZW compression, but the required storage space was quite large.
After making the disturbing white/black borders transparent and generating internal pyramids, the performance and visual quality were excellent—but the storage requirements became enormous.
So I referred to Paul Ramsey's article:
https://blog.cleverelephant.ca/2015/02/geotiff-compression-for-dummies.html
By using JPEG compression, I was able to reduce the storage requirement to about 1/6 of the original size, and the performance is still good.
However, the problem is that I now get black artifacts around the edges when accessing the data via WMS.
I suspect this is due to the JPEG compression.
In the ZIP archive linked below, you’ll find two screenshots showing the final result.
The script I’m using is somewhat old (some excerpts are also included in the ZIP archive), so there might already be better ways to achieve this?
These are the steps I currently follow:
* Create a mosaic VRT with alpha band from all source data
* Clip the mosaic VRT using a shapefile (to remove white/black borders) and transform it into the target coordinate system, using the 4th band (transparency) as a mask
* Generate tiles with a size of 10,000 x 10,000 pixels
* Compress the tiles
* Generate internal pyramids
Am I overlooking something in my process?
Do you have any ideas on how I can get rid of the artifacts while still keeping disk usage low?
https://drive.google.com/file/d/1zRY2Xj8eJ-T7e9p3qp4HEknum0VJR81W/view?usp=sharing
Best regards,
Carsten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20250527/bf03284a/attachment.htm>
More information about the gdal-dev
mailing list