Issue using display.save() with png files that have a transparent background

I have created a shape in my application and the fill leverages a png file. I would like to save my shape to a new image file using display.save(), however I have noticed an issue when the png, that is used as the fill of my shape, contains a transparent background (that is the png has a transparent portion and a non-transparent portion). The new image file gets created but the image is completely transparent; the non-transparent portion of my original image does not get captured.

However, if my shape uses a png that does not have a transparent background display.save() seems to capture my image properly.

In the example code below, if display.save() is called using ‘background’ then the new image is saved properly, but if the method is called using image or testGroup then the new image is completely transparent. Is this an issue with the display.save() method, or am I doing something wrong?

local testGroup = display.newGroup()
        sceneGroup:insert( testGroup )

        local background = display.newRect( testGroup, 50, 50, 100, 100)
        local image = display.newRect( testGroup, 50, 50, 100, 100)

        local paint = {
            type = "image",
            filename = "blue_circle.png"
        }

        image.fill = paint

        display.save(testGroup, { filename = "test_image.png",  baseDir = system.ApplicationSupportDirectory})

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.