I want to eliminate near black pixels around edges of Landsat-8 overview. I'm interested in doing it not for the entire image but some extent, so I clipped it. I tried using GDAL nearblack utility, but faced the problem that it doesn't take into account image border pixels.
nearblack -of GTiff -nb 1 -o mask.tif input.tif
Produces following result:
Is there a way to force GDAL nearblack utility to ignore pixels around image borders? To achieve my goal I also tried applying erosion with different structuring elements, but erosion produces "torn edges".