Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Artifacts on edges of overlapping parts of vrt #11583

Closed
zdila opened this issue Jan 6, 2025 · 6 comments
Closed

Artifacts on edges of overlapping parts of vrt #11583

zdila opened this issue Jan 6, 2025 · 6 comments
Assignees

Comments

@zdila
Copy link
Contributor

zdila commented Jan 6, 2025

What is the bug?

If I create a vrt from two overlapping masked geotiffs then there are artifacts on the edge of the overlap.

left.tif.gz
right.tif.gz

gdalbuildvrt final.vrt left.tif right.tif causes grayed line:

image

gdalbuildvrt -r lanczos final.vrt left.tif right.tif causes gray/black line:

image

Steps to reproduce the issue

Build vrt of attached files (use lanczos resampling for the most obvious result) and render it.

Versions and provenance

GDAL 3.11.0dev-badc1cd714, released 2025/01/05
Linux bono 6.11.10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.11.10-1 (2024-11-23) x86_64 GNU/Linux

Additional context

No response

@rouault
Copy link
Member

rouault commented Jan 6, 2025

`` causes grayed line:

If you display both left.tf and right.tif in QGIS, you'll see they gray artifact. This is not a GDAL issue (at least not on the rendering side), but rather due to the lossy JPEG compression which alters colors in the transition between data and nodata. To avoid that, at generation time, one should possibly have to not strictly apply the mask, but keep pixels that are slighlty out of it, to preserve a full 16x16 JPEG DCT encoding units. But that might not be desirable in some cases where one really needs to "censor" strictly pixels out of the mask

@zdila
Copy link
Contributor Author

zdila commented Jan 6, 2025

You are right, I did not notice that separate tiffs themselves have grayed edges. Just the lanczos resampling surprised me. Feel free to close the issue if there is nothing to fix/improve on gdal side. Thank you!

@zdila
Copy link
Contributor Author

zdila commented Jan 6, 2025

@rouault BTW i am creating those tiffs from RGBA zstd compressed geotiffs like this: gdal_translate right-tmp.tif right.tif -b 1 -b 2 -b 3 -mask 4 -co COMPRESS=JPEG -co PHOTOMETRIC=YCBCR

This creates that grayed edge. Should I report it as a separate issue? Or is it a feature? My intent is to nicely render a) slightly overlapping geotiffs; b) touching geotiffs. My source is jpeg-compressed geotiffs (without mask or alpha) and a separate mask for each. I want to use vrt so when just one geotiff updates (new aerial imagery for some area) then I don't need to reprocess all parts.

@rouault
Copy link
Member

rouault commented Jan 6, 2025

This creates that grayed edge. Should I report it as a separate issue? Or is it a feature?

there's nothing we can do in that use case from RGBA to RGB+mask+JPEG since the data has already been censored. What could potentially be done is convert RGB with a vector mask to RGB+mask+JPEG in a more colorful preserving way, but that would be quite involved and definitely not something I would tackle on maintenance funds. I would rather suggest you use other compression methods such as WEBP or JPEGXL which deal more nicely with alpha.

@zdila
Copy link
Contributor Author

zdila commented Jan 6, 2025

I see. Thank you for your suggestions, I will try it 🙂.

@rouault
Copy link
Member

rouault commented Jan 12, 2025

Fixed per #11585

@rouault rouault closed this as completed Jan 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants