You can use ImageMagick to convert images in varying ways, and it should be able to this quite easily. First you can split up into to parts (original.png
being the source image, and in this case 32x32pixels in size):
convert original.png -crop 32x32 parts-%02d.png
You can then convert it into a animation (use -loop 1
if you don't want it to loop):
convert -loop 0 -page +0+0 ./parts*.png output.gif
Resulting in:
The output PNGs of the first command have a offset included in them, so without the -page +0+0
option the animation ends up like:
There are varying other options you can include (mainly in the second command), such as -delay
etc - you can also optimize the animation so it is smaller (and faster to load/render) - e.g. borrowed from here:
convert output.gif -fuzz 10% -layers Optimize optimised.gif
or using gifsicle
gifsicle -O output.gif -o optimised.gif
EDIT: If the frames are transparent, you can set the frames to replace by adding the
-dispose Background
option, so when a frame is disposed of when the next one is loaded:
Example above done without the page
option so it shows clearly
The problem with this is you probably can't optimize the resulting image much then - so another way may be to make the frames opaque so the next frame covers the previous.
Best Answer
Try opening them with The Gimp; I believe it will open animated gifs with one layer per frame.
You say you don't want to dump all frames to files on a directory, but I'll tell you how to do it anyway :) install either ImageMagick or graphicsmagick, then:
for ImageMagick:
for graphicsmagick:
it'll write frames to target0.png,target1.png,... and so on. You can then enter the directory and run
eog
, it'll show you all the frames on the same application. When you no longer need the frames, justrm target*.png
.