[gdal-dev] Nearblack Eating Image Border

Christopher Mitchell crm350 at nyu.edu
Tue Feb 19 15:13:16 PST 2019


I've encountered an error in an image processing pipeline I've built
where nearblack is removing pixels at the border of images, even if
they don't fit the is-"black" criterion. Specifically, I'm using
nearblack to remove nearly-black areas touching the edges of lossy
image tiles that should be fully black. Those images are later
combined into VRT files and warped; where we have multiple tiles
overlapping an area, some of which are missing data, we therefore can
get complete coverage.

Unfortunately, for tiles that have no black areas, nearblack is still
eating the -nb argument's number of pixels at the edges, turning them
into black (0, 0, 0, 0, where we're using 4-channel images), even if
those pixels are nowhere near the color criterion to be recognized as
black. My understanding was that nearblack should only be proceeding
into the interior of the non-black area and then setting pixels to
black if those pixels are /actually/ nearly black.

Am I encountering a bug with nearblack? Do I misunderstand how the -nb
argument works? Happy to provide a MWE if any of the above is unclear,
and thanks in advance.


More information about the gdal-dev mailing list