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

gdaladdo creates black edges if mask is used #11555

Closed
zdila opened this issue Dec 29, 2024 · 3 comments · Fixed by #11562
Closed

gdaladdo creates black edges if mask is used #11555

zdila opened this issue Dec 29, 2024 · 3 comments · Fixed by #11562
Assignees

Comments

@zdila
Copy link
Contributor

zdila commented Dec 29, 2024

What is the bug?

gdaladdo creates black edges if mask is used

Input file: input.tif.gz

Rendered before adding overviews:
image

Steps to reproduce the issue

Run gdaladdo -r lanczos --config COMPRESS_OVERVIEW JPEG --config PHOTOMETRIC_OVERVIEW=YCBCR input.tif on geotiff with following metadata:

Image Structure Metadata:
  SOURCE_COLOR_SPACE=YCbCr
  COMPRESSION=YCbCr JPEG
  INTERLEAVE=PIXEL
  JPEG_QUALITY=75
  JPEGTABLESMODE=1
Band 1 Block=13092x16 Type=Byte, ColorInterp=Red
  Mask Flags: PER_DATASET 
Band 2 Block=13092x16 Type=Byte, ColorInterp=Green
  Mask Flags: PER_DATASET 
Band 3 Block=13092x16 Type=Byte, ColorInterp=Blue
  Mask Flags: PER_DATASET 

Rendered after adding overviews:
image

Note that i render image onto red background.

Versions and provenance

GDAL 3.11.0dev-051a853584, released 2024/10/31
Linux bono 6.11.10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.11.10-1 (2024-11-23) x86_64 GNU/Linux

Additional context

#11535 (comment)

@jratike80
Copy link
Collaborator

Have you tried with lossless compressed overviews?

@jratike80
Copy link
Collaborator

This gives an error

gdaladdo -r lanczos --config COMPRESS_OVERVIEW deflate input2.tif
0...10...20...30...40...50...60...70...80ERROR 1: RGBA interpreted raster bands are read-only.
ERROR 1: RGBA interpreted raster bands are read-only.
ERROR 1: RGBA interpreted raster bands are read-only.
ERROR 1: IReadBlock failed at X offset 0, Y offset 0
...90...100 - done.

but nearest resampling with no compression gives sharp edges

gdaladdo input3.tif

rouault added a commit to rouault/gdal that referenced this issue Dec 30, 2024
…COMPRESS_OVERVIEW != JPEG

Fixes comment OSGeo#11555 (comment)
but not the core issue itself
@zdila
Copy link
Contributor Author

zdila commented Dec 30, 2024

For me it seems like compression doesn't cause it but resampling method does.

  • gdaladdo input.tif - no problem
  • gdaladdo -r near input.tif - no problem
  • gdaladdo -r average input.tif - no problem
  • gdaladdo -r rms input.tif - no problem
  • gdaladdo -r mode input.tif - thin black edges
  • gdaladdo -r average_magphase input.tif - thin black edges
  • gdaladdo -r bilinear input.tif - medium black edges
  • gdaladdo -r cubic input.tif - medium black edges
  • gdaladdo -r gauss input.tif - medium black edges
  • gdaladdo -r cubicspline input.tif - thick black edges

@rouault rouault self-assigned this Dec 31, 2024
rouault added a commit to rouault/gdal that referenced this issue Dec 31, 2024
rouault added a commit that referenced this issue Jan 4, 2025
…COMPRESS_OVERVIEW != JPEG

Fixes comment #11555 (comment)
but not the core issue itself
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

Successfully merging a pull request may close this issue.

3 participants