Implemented image masking.