I have a series of black-and-white images, like this:
ImageMagick converts thems to mask, using connected-components
magick *.png -define connected-components:area-threshold=130 -define connected-components:mean-color=true -connected-components 8 -negate mask\mask-%02d.png
After that I'd like to apply this masks to original images and get images without grid lines.
How to do this using one ImageMagick command? I have the series of images, not one.


One way might be to composite the two images together choosing the darker of the two at each pixel location:
If you want to do all steps in a single command, you can use: