I have a PNG file that has all of the frames of an animation stacked on top of each other. It's a 40x40 image, so the first frame is at 0,0. The second frame is at 0,40... etc. I'd like to extract those frames into an animated GIF.
Now, I actually have 110 of such files, each with a different number of frames, so I'm hoping this can be done without specifying the number of frames.
Is there a way to do this?
I know it could be done easily if each frame was in its own file, so the next best solution is splitting them into multiple files, but I don't know how to do that either - but again, I'd have to split them without specifying the number of frames, so I can do a batch job on all of the files.
Create animated GIF from PNG with all frames in one file
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Create animated GIF from PNG with all frames in one file
What version of IM, on what platform?
PNG files contain only one image. I think you mean that the file contains all the frames in a single image, with the frames appended vertically. Each frame is 40 pixels high.
This splits the input into frames, and makes a GIF from it.
Does that work?
PNG files contain only one image. I think you mean that the file contains all the frames in a single image, with the frames appended vertically. Each frame is 40 pixels high.
Code: Select all
magick in.png -crop x40 +repage out.gif
Does that work?
snibgo's IM pages: im.snibgo.com
Re: Create animated GIF from PNG with all frames in one file
Yes! That works wonderfully. Thank you. I knew it must be easy.
Now the frames have a transparent background and each frame is being written over the last one. I tried using "-dispose previous" and "-dispose background" but neither have any effect.
Is there a way to clear the canvas between frames?
Now the frames have a transparent background and each frame is being written over the last one. I tried using "-dispose previous" and "-dispose background" but neither have any effect.
Is there a way to clear the canvas between frames?
Re: Create animated GIF from PNG with all frames in one file
I found this: http://www.imagemagick.org/discourse-se ... hp?t=33974
I just need to put "-dispose previous" before the input file.
Thanks again!
I just need to put "-dispose previous" before the input file.
Thanks again!
Re: Create animated GIF from PNG with all frames in one file
And I'm using 7.0.8-48 Q16 x64 on Windows 10.