What is the maximum image size that can be added to a snapshot?

Hello,

I have two questions related to maximum image size of a snapshot.

What is the maximum image size that can be added to a snapshot?
I noticed that when I create a rectangle and use an image for the fill, the snapshot will not render the image if one of its dimensions exceed 1024 (the snapshot will display all black).

I assumed the maximum size of my rectangle could not exceed the maximum texture size as defined by system.getInfo( “maxTextureSize” ), but it is actually a fourth of that in this case (the maxTextureSize is 4096). Is there some programatic way to determine the maximum size image? Will it always be maxTextureSize/4?

What is the maximum image size that can be added to a snapshot if the fill is rotated?
I noticed that if the fill is rotated then the snapshot will display all black if the dimensions of the image are 1024. But if I change the the dimensions to 1012 the snapshot renders properly. The code below renders all black on my ios device but if I remove the rotation or reduce the image height to 1012 then it renders properly.

local function createSnapshot()
    local imageWidth = 675
    local imageHeight = 1024
    local rectangle = display.newRect(0, 0, imageWidth, imageHeight)

    local paint = {
        type = "image",
        baseDir = system.ResourceDirectory,
        filename = "test.png"
    }
    rectangle.fill = paint
    rectangle.fill.rotation = 90 -- This rotation causes the snapshot not to render when imageHeight == 1024

    local snapshot = display.newSnapshot( imageWidth, imageHeight )
    snapshot.group:insert(rectangle)

    snapshot:invalidate()

    snapshot.x = display.actualContentWidth/2
    snapshot.y = display.actualContentHeight/2

    return snapshot
end

If you’re also developing for Android, and not just desktop platforms, then I think the recommendation is still to not use textures larger than 2048x2048, even if the device supported larger textures. With some Android devices, you might need to add large heap to your build settings.

Also, do keep in mind that if you take screenshots, then they will also be affected by Solar2D’s dynamic scaling. You’ll need to offset the scaling by using the scale factor.

Would the details (in particular the 1012) be consistent with the first issue mentioned here?

Thank, I’ll make sure to keep my textures under that threshold and account for the scale factor.

Thanks for linking that issue. It does appear like it might be related.

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