="http://www.w3.org/2000/svg" viewBox="0 0 512 512">

5 Convert the images into an Animated Gif

1. Use imagemagick to convert the png/jpg images to an animated gif:

convert *png animated.gif

2. If you removed a lot of frames (or there is some other reason) you may find that the gif loops too quickly. You can adjust the time by using the ‘-delay’ flag:

convert -delay 25 *png animated.gif

Anmated gif demonstrating how it is easier to understand when slowed down by using the -delay option.

This is better for actually seeing what happens.

3. Another way to reduce file size is to resize the gif to a smaller, but still coprehensible size[1]:

convert *png -resize 400x animated.gif

Animated gif demonstrating how to decrease file size by scaling down the image.

The gif is 400px wide.

4. While there are a lot of ways to optimize a gif, imagemagick has a built-in optimizer which generally does a good job. The size of the gif went from 559kB to 46kB without having to sacrifice size:

convert *png -layers Optimize animated.gif

Animated gif demonstrating how using the '-layers Optimized' option reducing file size.

This gif is at optimal capacity.

5. And we can combine some of the above to make a gif that isn’t too big and is comprehensible:

convert -delay 25 *png -layers Optimized animated.gif

Animated gif combining all the above flags.

See how much better this is?


  1. the '400x' part tells imagemagick to make the gif 400px wide while maintaining the aspect ratio

License

Icon for the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License

Convert the images into an Animated Gif by York University Libraries is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License, except where otherwise noted.

Share This Book