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 blended image, only the lighter parts of the second images are visible: