Resizing GIFs where each frame is the size of the whole gif works fine.
However, if frames are smaller and have an offset, the offset is not resized, such that these frames appear in the wrong place.
I'd be happy for my team to work on this if I could get some direction on where the bug probably is in the code. I've never poked around ImageMagick source. We really need this to work correctly .
Resizing certain GIFs produces incorrect output
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Resizing certain GIFs produces incorrect output
Have you tried doing something like
see
http://www.imagemagick.org/Usage/anim_opt/#optframe
http://www.imagemagick.org/script/comma ... php#layers
Code: Select all
convert animation.gif -coalesce -resize XX -layers Optimize newanimation.gif
http://www.imagemagick.org/Usage/anim_opt/#optframe
http://www.imagemagick.org/script/comma ... php#layers
Re: Resizing certain GIFs produces incorrect output
Doesn't -coalesce remove the offset optimization? That defeats the purpose of resampling (reducing bandwidth usage), and IIRC, didn't work completely either.
Re: Resizing certain GIFs produces incorrect output
Doesn't -coalesce remove the offset optimization? That defeats the purpose of resampling (reducing bandwidth usage), and IIRC, didn't work completely either.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Resizing certain GIFs produces incorrect output
I am not an expert on animations, but I was under the impression that the -layers optimize reverses the coalesce and gets you back to your original size and offset, or at least, a trim back to smaller sizes maintaining that offset. see the example at http://www.imagemagick.org/Usage/anim_opt/#optframe
What version of IM and platform are you using?
What version of IM and platform are you using?
Re: Resizing certain GIFs produces incorrect output
Hm, that does indeed work, thanks! It still does increase the size by about 35% in my particular test case if it's the same size, but it's still worth it when resampling to half the width
Re: Resizing certain GIFs produces incorrect output
Interesting: using the same arguments you suggested with mogrify results in the same bug as frames having the unresized offset, but convert works. I'm using Ubuntu 14.04 BTW, and Version: ImageMagick 6.7.7-10 2014-03-06 Q16
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Resizing certain GIFs produces incorrect output
IM 6.7.7-10 is very old, about 120 versions old. You might benefit from an upgrade. Nevertheless, mogrify is not as full functioning as convert. So your results are not surprising. If your animation is not too large and not proprietary, you might upload it to some free hosting service such as dropbox.com and put a link here. We could then see if there is any further size reduction on a more current version of IM.
You might also try one of the non-IM tools such as listed at http://www.imagemagick.org/Usage/formats/#gif_non-im to see if you can further reduce the size.
See also http://www.imagemagick.org/Usage/anim_opt/#compress_opt for non-IM optimization
See also http://www.imagemagick.org/Usage/anim_opt/#removedups for removing duplicate frames
You might also try one of the non-IM tools such as listed at http://www.imagemagick.org/Usage/formats/#gif_non-im to see if you can further reduce the size.
See also http://www.imagemagick.org/Usage/anim_opt/#compress_opt for non-IM optimization
See also http://www.imagemagick.org/Usage/anim_opt/#removedups for removing duplicate frames