Pixpipejs

This does the following :

Note that using a parametric math expression with pixpipe.ImageBlendExpressionFilter is generally slower.

The original image and the mask:

The masked image: