13

I've been looking at various gif optimizers and converters and I couldn't find one that would work good for me.

The function in the app I'm looking for is comparing frames of an animated gifs, determining which consecutive frames are similar enough to unnoticeably remove them and merge their display duration.

For example, frames 2 through 5 are the same, and each of them is shown for 0.02 second. Frames 3,4,5 are deleted and frame 2 is shown for a total of 0.08 seconds.

What application or an image-processing toolkit has the ability to do that automatically? I'm not looking for solutions that mean I will have to compare the frames myself (like using Photoshop or Gimp for this).

2
  • 1
    Is any operating system (Linux, Android, etc) OK?
    – Nicolas Raoul
    Commented Dec 2, 2015 at 11:05
  • I did it on Windows using ImageMagick, but I suppose answers for other OSes would be useful too. Commented Dec 9, 2015 at 14:50

4 Answers 4

6

ImageMagick is a well-known commandline app that has been around for a while and it claims to do exactly what you are asking.

To let you remove [...] useless duplicate frames from a coalesced animation, a 'RemoveDups' method has been provided. This compares each frame with the next frame in the animation, and removes the first frame if they are identical (with color similarity set by the current Fuzz Factor).

Also to ensure that any timings in the animation are not lost, the Timing Delays of the two frames are also merged.

According to the documentation, here is the command to do so:

  convert moving_hole_oplus.gif -coalesce -layers RemoveDups  gif:- |\
     gif_anim_montage - moving_hole_oplus_rmdups_frames.gif
1
  • It works, but why it destroys the delta encoding? The end GIF turns out to be bigger before the merge
    – tribbloid
    Commented May 15, 2021 at 23:44
1

I found these online services that do offer online GIF compression including a deduplication in frames:

https://www.iloveimg.com/compress-image (Does not explicitly advertise this deduplication, but I checked the resulting GIFs.)

https://compress-or-die.com/gif (Just to provide an alternative. Their max upload file size is 16MB which was too low for me so I switched to the first option.)

Not sure if an online service is what you're looking for, but for me this was the solution I was looking for.

1
  • I'm really very much against using online services for answers, because what if you want to do a bulk optimization of your stash and the site rate-limits you or something. There are also privacy concerns. But I guess other visitors to this question might find it useful if they don't care about any of that. Commented Sep 22, 2019 at 14:09
0

GIMP

It is sort of a steep learning curve when creating gifs through gimp, but once you can tell which can be kept, and which can be safely deleted after using Filters - Animation - Optimize (for GIFs), you can shave off some KBs before resizing. Of course you can recheck the 'project' before exporting it into a gif format.

0

https://ezgif.com/optimize does just that.

Upload your image and select "Remove duplicate frames" in "Method" select box.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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