Mask inverted for png image

Hi Chris,

I’m trying to show part of an png image using mask but it’s not working as I intended. When I turned on ‘inverted’ option, it’s working - the masked part of the image is gone. But what I want is the opposite. Do you have any advice on this? Does it have something to do with the png file itself?

Thanks,
Hansem

stimulus/layer chosen_target {
stimulus/image_file chosen_target_number_line (
path=‘image/number_line.png’
x_size = line_size // 15 degree (orignal image:800 x 20 pix)
y_size = 30
x_position = line_x
y_position = 0 // line_y
rotation = line_theta
fullscreen = YES
)
mask (
mask = rectangle // ellipse // gaussian // std_dev
// inverted = YES // false // true
x_size = 1
x_position = responseX
y_position = 0 // line_y
)
}

Hi Hansem,

Masks affect only the screen region within their boundaries. (In your example, the masked region is a 1x1 square centered at (responseX, 0).) For that reason, non-inverted rectangular masks aren’t very useful, because they let everything underneath them show through and don’t block anything that isn’t underneath them. Non-inverted masks are mostly useful for erasing/smoothing the edges of otherwise rectangular stimuli.

If your goal is to use a mask to expose just a portion of a larger image, you need to use an inverted mask plus another stimulus that hides the image. The mask will erase the desired portion of the “hiding” stimulus, allowing the image to show through. The attached example demonstrates one way to do this.

Cheers,
Chris
image_mask.zip (2.4 KB)