Add support for AND-OR masking in all images