Most efficient way to crop/resize animated gif

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Somebi
Posts: 5
Joined: 2010-10-16T22:09:45-07:00
Authentication code: 8675308

Most efficient way to crop/resize animated gif

Post by Somebi »

For example doing this:

/usr/bin/convert test.gif -coalesce -resize 200x200 test.gif

with this animated gif http://glitters.ru/images/butterfly_20008.gif (3 frames), took me roughly 1min and 9 seconds. It's a bit too much...

I was trying to do this on VDS with 800mhz and 256 ram.

Is there any efficient solution? Or i should stop searching, because there is not?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Most efficient way to crop/resize animated gif

Post by fmw42 »

I am not a real expert on animations, but as far as I know what you have done is all you can do besides adding optimization, which is not a speed issue but a file size issue.

see
http://www.imagemagick.org/Usage/anim_basics/
http://www.imagemagick.org/Usage/anim_opt/
http://www.imagemagick.org/Usage/anim_mods/

You could do

convert anim.gif -resize ... newanim.gif

but that only works if each frame of the animation is a full frame and not an update. That is why you need -coalesce to be sure.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Most efficient way to crop/resize animated gif

Post by anthony »

That animation has a LOT of very low level pixel patterns. Any form of resize is not going to work well. It will either result in large pixels, or a uniform less glittery output.

The best idea is to try and extract the original static image, and its glitter mask, resize those and then re-add the glitter to re-create the animation at the new size.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply