Best way to extract / import frames from a single sprite sheet

When editing and designing a character I work with a single sprite sheet in Photoshop (or in my case Gimp): This is the standard format for animated sprites, multiple independent images are a nightmare to jump between for small changes like a color swap. Sadly GDevelop expects every frame to be its own image, you can’t define sections in single sprite sheet. This requires the artist to update the actual frame files manually, opening all then copy-pasting each frame from the sprite sheet in place of the old frame; It’s very difficult and time consuming to do regularly whenever you change your character.

Does anyone have a solution they can recommend? Is there some way to get GDevelop to accept sprite sheets and take ranges, maybe a new feature for a future version? Even a builtin importer?

If not, although this is no longer a GDevelop specific question: Does anyone have a command I can run in a console (Linux) for a tool like Imagemagick, to automatically take each frame and put it in the appropriate file? If so I can write a shell or Python script that goes through all frames in my atlas with commands like “for top-left position 128 x 192 at tile size 32 x 32 crop the frame into player_walk_3.png”.

FYI: the Piskel editor can import sprites. IDK how easy or good it does it.

1 Like

Thanks. Sadly it won’t work in my case as it states the sprite sheet must be a single animation: I have multiple animations chained in various areas of the image. Looks like my best bet is a script I can run to generate them, I’ll look up what the command is for Imagemagick tomorrow.

1 Like

I’m sure there’s an app or website out there. Keep Googling. Good luck.

There are no announced plans to implement support for spritesheets at this time.

As far as splitting them if you have them already: Some of the ones I’ve worked with in the past:

1 Like

Thanks. I have found my answer in precisely the format I was looking for:

Using the ImageMagick crop command, I’ll be making a shell script for each sprite sheet (eg: for char.png) which I just click to apply updates from my spritesheet source to GDevelop.

Here’s a section of how it looks like: Given I have multiple transformations but the spritesheet for each version is identical, I threw in a loop that does the same thing for every state in my case.

magick convert "normal.png" -crop 32x32+0+0 "normal_idle_1.png"
magick convert "normal.png" -crop 32x32+32+0 "normal_idle_2.png"
magick convert "normal.png" -crop 32x32+64+0 "normal_idle_3.png"
magick convert "normal.png" -crop 32x32+96+0 "normal_idle_4.png"