Hi!
You made some mistakes in writing.
Furthermore display.actualCenterX, display.actualCenterY don’t work. Use “display.contentCenterX, display.contentCenterY”.
Said this the main mistake was to put the black background when saving the group and not to put “isFullResolution=true”.
For more information check out the documentation: https://docs.coronalabs.com/api/library/display/save.html
Anyway I wrote a small working example, it should be what you wanted:
local maskgroup = display.newGroup() maskgroup.x, maskgroup.y = display.actualCenterX, display.actualCenterY local rect = display.newRect( maskgroup, 0, 0, 400, 400 ) rect:setFillColor( 0, 0, 0) local roundedRect = display.newRoundedRect( maskgroup, 0, 0, 350, 150, 35 ) roundedRect:setFillColor( 1, 1, 1) local text = display.newText(maskgroup, "SAVE", 0, 0, system.nativeFont, 100) text:setFillColor( 0, 0, 0 ) display.save( maskgroup, { filename="mask.png", baseDir=system.CachesDirectory, isFullResolution=true}) --backgroundColor={0,0,0,0} } ) maskgroup:removeSelf() maskgroup = nil local g = display.newGroup() g.x, g.y = display.contentCenterX, display.contentCenterY display.newRect( g, 0, 0, 500, 500 ).fill = {1,0,0} local mask = graphics.newMask( "mask.png", system.CachesDirectory ) g:setMask( mask )
The image comes out of the screen but I’m based on your size I think there will be a reason if you wanted it that way.