Editing imagery blending fragment shader


I would like to perform some image processing in the imagery blending fragment shader to make nearblack/nearwhite pixel transparent. I have implemented similar solutions before including in-shader NDVI calculation. This would be similar to the gdal nearblack tool. JPG’s are much smaller to store and serve, however suffer from the lack of transparency issue for non-global dataset being blended into a global one. See screenshot.