Create an animated "contact sheet" of gifs
Create an animated "contact sheet" of gifs
Using montage and append seem intended for stills and will unpack animated gifs into individual frames. I would like to combine many gifs into a "contact sheet" of animations. Is this possible without knowing the size of each source gif beforehand? I imagine the source gifs may need to be trimmed or forced into the same speed and duration, which is okay.
Thanks
Version: ImageMagick 7.0.8-59 Q16 x86_64 2019-08-05
Thanks
Version: ImageMagick 7.0.8-59 Q16 x86_64 2019-08-05
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Create an animated "contact sheet" of gifs
I'm not sure what you want. Perhaps you have a number of animated GIFs, and you want to create a single GIF that is made from the input GIFs placed side-by-side or below each other, or in a grid.
This is easily done by keeping the GIFs separate, and showing them on an HTML page.
Combining them into a single GIF (which will be limited to 256 colours, and may need re-sizing and re-timing of each input) can be done. See http://www.imagemagick.org/Usage/anim_mods/#append and other sections of that page.
This is easily done by keeping the GIFs separate, and showing them on an HTML page.
Combining them into a single GIF (which will be limited to 256 colours, and may need re-sizing and re-timing of each input) can be done. See http://www.imagemagick.org/Usage/anim_mods/#append and other sections of that page.
snibgo's IM pages: im.snibgo.com
Re: Create an animated "contact sheet" of gifs
Thanks, and sorry for my unclear wording. I wanted to combine many GIFs into a single GIF.
It seemed like the 'anim_mod' examples were geared towards when you know the exact size and how many source gifs need to be appended. I was wondering if there was a technique more similar in flexibility to montage, which I can be given any number images, all at different sizes, and it automatically creates a nice "contact sheet". The potential re-sizing and re-timing compromises are not an issue for me.
It seemed like the 'anim_mod' examples were geared towards when you know the exact size and how many source gifs need to be appended. I was wondering if there was a technique more similar in flexibility to montage, which I can be given any number images, all at different sizes, and it automatically creates a nice "contact sheet". The potential re-sizing and re-timing compromises are not an issue for me.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Create an animated "contact sheet" of gifs
I think you would need to write a script for that.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Create an animated "contact sheet" of gifs
Are you asking to take one animated gif and extract all the frames and make a contact sheet of those? Or are you asking to make an animated contact sheet from many animated gifs?
Re: Create an animated "contact sheet" of gifs
The latter. I want to make an animated contact sheet from many animated gifs.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Create an animated "contact sheet" of gifs
The problem with that is that you need to sync the animations. That generally only works well if you have the same number of frames and the same delays in all the animations. See https://imagemagick.org/Usage/anim_mods/#merging
Re: Create an animated "contact sheet" of gifs
I wouldn't mind if the frame counts and delays are adjusted in order to make it work; similar to how montage will resize images to match the largest/smallest image in the grid.
It sounds like there isn't currently a magical way to do this, so I will try this process:
1. Separate each source animation into coalesced static frames.
2. Find the GIF with the most frames (X), and add frames to all other GIFs until they also have X frames.
3. Loop over X frames, grabbing a frame from each source GIF then generating a static contact sheet using the montage command.
4. Finally, take all those static contact sheet images and compile into a single animated contact sheet GIF.
Let me know if a simpler way comes to mind, otherwise thanks for helping me think through it.
It sounds like there isn't currently a magical way to do this, so I will try this process:
1. Separate each source animation into coalesced static frames.
2. Find the GIF with the most frames (X), and add frames to all other GIFs until they also have X frames.
3. Loop over X frames, grabbing a frame from each source GIF then generating a static contact sheet using the montage command.
4. Finally, take all those static contact sheet images and compile into a single animated contact sheet GIF.
Let me know if a simpler way comes to mind, otherwise thanks for helping me think through it.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Create an animated "contact sheet" of gifs
I can create a montage of animations and it will animate using the latest beta (IM 6.9.10.69 or IM 7.0.8.69). If they have different numbers of frames, an empty spot will appear. So it should be easy for you to create your contact sheet of animations. Just make the tiling correspond to the number of animations you provide and include your new desired delay.
Code: Select all
convert -delay 20 lena.jpg mandril3.jpg zelda1.jpg anim1.gif
convert -delay 20 lena.jpg mandril3.jpg anim2.gif
magick montage -delay 50 anim1.gif anim1.gif anim1.gif anim1.gif -tile 2x2 anim_montage1.gif
magick montage -delay 50 anim1.gif anim1.gif anim1.gif anim2.gif -tile 2x2 anim_montage2.gif
Re: Create an animated "contact sheet" of gifs
Starting from your example, it seems like ImageMagick jumbles up the frames between different GIFs. In your example, it's hard to tell since the source gifs don't have any linear continuity.
Here's my result using 4 copies the same source gif:
Source gif: https://tni-art-eater.s3.us-east-2.amaz ... ums/1a.gif
Result:
And 4 completely different source gifs:
Here's my result using 4 copies the same source gif:
Code: Select all
montage 1a.gif 1b.gif 1c.gif 1d.gif -tile 2x2 montage_same.gif
Result:
And 4 completely different source gifs:
Code: Select all
montage 1.gif 2.gif 3.gif 4.gif -tile 2x2 montage_different.gif
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Create an animated "contact sheet" of gifs
You need to add the -delay so we can see better. Perhaps it syncs when a delay is properly set. You need to use the beta version or wait for it to be released in order to use -delay in montage.