Large Image: Error Occured,outofmemoryerror Java heap space

I created a png that is 11000x1500 containing 11 sprites for 1 animation. I was able to open the project file. I added the image into the assets folder. I created a tilesource and tried to open the image onto it but the window stopped responding. I left it for around 10-15 min and came back to:

An error occurred:

java.lang.OutOfMemoryError: Java heap space

I’m guessing that it has to do with the large image size but I’m not sure.

Wow, that’s a big animation! Are you going to use it in its original size?

That’s never gonna fit in a GPU texture. For most situations, you should limit yourself to 4096x4096 or, at most, 8192x8192 textures.

1 Like

I made this image as a guide for what I wanted the final game to look like. The animations would be used for the two sprites in the middle.

1 Like

I see your game’s target resolution is 750x1334. Why would you need the sprites at that insane 1k x 1.5k resolution? Crop out any extra transparent space (that exists across all frames) and resize them to the resolution they’re going to get used at in your game. Also, you can create the animation directly in a Defold atlas. Just make an atlas, take your 11 individual pngs and add them to a new animation group. Defold will take care of laying out the individual sprites on a sprite sheet on its own.

1 Like

Ok thanks. I resized the sprites to 150x175 and resized the display in my defold project to 320x568. My only concern is how it will look when scaling to larger devices.

Yes, this is a balancing act. You can almost be guaranteed that it will be scaled to at least twice the original size given that it’s only 320x568 pixels.

Another option would be to split the graphics even further and animate it procedurally using go.animate() instead of flipbook animations.

1 Like