apply mask to images