Masks not working properly

Hello,

Trying to make a standard mask effect and a weird maybe glitch is occurring.
If I use a png file that came with the Corona SDK as one of the example files as the mask for an image, it works just fine.

However, when I make a png image that I want to use as a mask in photoshop and save it as a png with the default photoshop png format settings is where the problem occurs. When I set it as a mask, the image that I attach the mask behaves weird. The area to the right of the masked portion as it should does not display any part of the image, but the part of the image to the left of the masked portion either displays fully or with wavy lines through it, and of course it should not be visible at all.

I pasted below the code that I used, so you can see there is nothing out of the ordinary there.
Also note that my png mask dimensions are significantly smaller than the image I am masking out and I even extremely moved the mask way to the right to show that I’m not still just viewing inside the masked area.
As I said before, if I move the mask to the left, the image area to the right will stop displaying as it should.

mask1 = graphics.newMask("images/mask1.png")  
imageToBeMasked = display.newImage("images/imageToBeMasked.png")  
  
imageToBeMasked:setMask(mask1)  

Is there a certain exact format the png file has to be saved in in order to work properly as a mask?

Thanks in advance.

Best Regards,

Jim [import]uid: 185542 topic_id: 33424 reply_id: 333424[/import]

Make sure the mask has a 4 pixel black border and make sure its total width and height are divisible by 4. [import]uid: 135827 topic_id: 33424 reply_id: 132775[/import]

I also don’t know if masks work with 8bit png’s (Index) vs. 24bit (RGB - in Photoshop terms) files. [import]uid: 199310 topic_id: 33424 reply_id: 132800[/import]

Thanks george18 and Rob for your quick responses.

@george18 - That was it. Thank you. I just realized that is actually written in the Corona guide on bitmap masks as a limitation, but somehow I didn’t even notice it. Works great!

@Rob - I went ahead and just saved the png as 8-bit this time and that also seem to work.

Thanks again guys for the quick response!

Best Regards,

Jim [import]uid: 185542 topic_id: 33424 reply_id: 132836[/import]

Make sure the mask has a 4 pixel black border and make sure its total width and height are divisible by 4. [import]uid: 135827 topic_id: 33424 reply_id: 132775[/import]

I also don’t know if masks work with 8bit png’s (Index) vs. 24bit (RGB - in Photoshop terms) files. [import]uid: 199310 topic_id: 33424 reply_id: 132800[/import]

Thanks george18 and Rob for your quick responses.

@george18 - That was it. Thank you. I just realized that is actually written in the Corona guide on bitmap masks as a limitation, but somehow I didn’t even notice it. Works great!

@Rob - I went ahead and just saved the png as 8-bit this time and that also seem to work.

Thanks again guys for the quick response!

Best Regards,

Jim [import]uid: 185542 topic_id: 33424 reply_id: 132836[/import]