Is there a way, perhaps with ffmpeg or convert, to constrain the size of a GIF created by stitching PNG files?

This answer (Creating a GIF animation from PNG files) does not address this, and apparently the instructions are out of date.


the -layer option of convert can optimize frames and often result in gifs with smaller sizes.

this for example optimizes by reducing the number of pixels per frame:

convert *.gif -layers optimize-frame  animation.gif

also the -colors option limits the maximum number of unique colors.

  • Thanks, but is there a way to explicitly limit the file size? – zadrozny Jun 12 '16 at 16:17
  • no, it seems that's impossible. I'll keep looking and update my answer if i find anything. – user133612 Jun 12 '16 at 19:21
  • 1
    What tools / software is best practice for creating gifs (like those posted on giphy.com)? At 37 MB, what I've got is far to large to be shared on Twitter (or for that matter most web pages). – zadrozny Jun 13 '16 at 13:52
  • I don't know what's the best one, I use gimp it is the easiest and can also play a preview of the animation before exporting the gif. – user133612 Jun 13 '16 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.