[gdal-dev] GDAL COG random fringe on zoom levels

Even Rouault even.rouault at spatialys.com
Fri Dec 17 15:20:45 PST 2021


Pasted into https://github.com/OSGeo/gdal/issues/5016

Le 17/12/2021 à 23:25, Craig Bruce a écrit :
> I tried to submit this issue on GitHub, but it wouldn't let me press 
> the Submit button and wouldn't tell me why not.
>
> ## Expected behavior and actual behavior.
>
> The generation of Cloud-Optimized GeoTIFF images sometimes includes an 
> fringe of random colors around the edge of opaque and transparent 
> pixels of the coarser zoom levels.
>
> The edge of a COG level with an alpha channel should be a smooth 
> tapering of translucent pixels with the proper colors from the source 
> image.
>
> ## Steps to reproduce the problem.
>
> Using GDAL-3.3.1, take an image [like this, 
> naip_denull.tif](https://drive.google.com/file/d/1KIJ-8E3nxxaVCdQ1uaKE4rcZtCtlqT0x/view?usp=sharing) 
> (188 MB) and run:
>
> $ gdal_translate naip_denull.tif cog.tif -of COG -co COMPRESS=LZW
>
> Then open the COG in an application like GIMP that lets you select 
> which zoom-level to view.  Choose the coarsest level and view — random 
> fringe!
>
> Screenshot: 
> ![naip_fringe_screen](https://user-images.githubusercontent.com/18429680/146596047-1081f20b-e6cb-4670-82f4-099ea8525032.png)
>
> All of the reduced-resolution levels have this problem to a degree, 
> though the more zoomed-out ones have it worse.  Using these levels to 
> produce a map makes it look bad.
>
> The problem seems to be exacerbated by the source image having pixels 
> that are either fully opaque or fully transparent and by the image 
> content having complicated patterns, such as streets.
>
> My guess is that the resampling method when generating a zoomed-out 
> pixel is indiscriminately including source-pixel values that are fully 
> transparent and shouldn't be included.  The randomness of the fringe 
> suggests that the sample values for transparent pixels remain 
> uninitialized as some kind of optimization.
>
> I've seen this problem before on other systems with a dark fringe from 
> erroneously including transparent pixels that have sample values of 0.
>
> ## Operating system
>
> Fedora 33 Linux, x64.
>
> ## GDAL version and provenance
>
> GDAL-3.3.1.
>
> -- 
> Dr. Craig S. Bruce
> Senior Software Developer
> CubeWerx//Inc.
> https://www.cubewerx.com <http://www.cubewerx.com/>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20211218/92cf39d4/attachment.html>


More information about the gdal-dev mailing list