Animated Gif downsize conversion

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
degarb
Posts: 9
Joined: 2014-11-26T07:08:38-07:00
Authentication code: 6789

Animated Gif downsize conversion

Post by degarb »

http://ready.arl.noaa.gov/data/forecast ... 2/anim.gif

I want to wget grab (windows xp) the above (each hour) 900k gif, extract, resize (for cell phone), reassemble, and wput smaller gif to my website for my smart phone weather page. I like that animation (would be useful 2 times daily), but the size is unnecessarily large.

I am googling, but little is coming up. Anyone know the code, and how to do any needed plugin?

I am not an advanced user. I only (back in 2009) wrote a few dos imagemagick bat files for enhancing my family photos, resizing & animating weather sat/radar images to be uploaded to my weather website for better mobile weather tracking than currently available. (longer animations, smaller files, more resolution in my local weather relevant area, images that are optimized for 2 and 3 inch screens)--Thanks.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Animated Gif downsize conversion

Post by snibgo »

Code: Select all

wget http://ready.arl.noaa.gov/data/forecast/grads/rap/panel2/anim.gif

convert anim.gif -resize 200x200 a.gif

wput a.gif ftp://myhost.com/mypath/myfile.gif
Use "at" or "schtasks" to run this every hour.
snibgo's IM pages: im.snibgo.com
degarb
Posts: 9
Joined: 2014-11-26T07:08:38-07:00
Authentication code: 6789

Re: Animated Gif downsize conversion

Post by degarb »

This worked really well--without destroying the animation. Shockingly easy.

Thanks.

I am afraid to ask. But does this work on all or most gif animations?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Animated Gif downsize conversion

Post by snibgo »

This particular gif has every frame stored as a complete image. Many gifs have optimised frames. Roughly speaking, only "differences" are stored. So a general technique is to coalesce frames, which makes each one a complete image. Then optimize afterwards.

Code: Select all

convert in.gif -layers coalesce -resize 200x200 -layers optimize out.gif
I think this will work on all gifs, but I'm not an expert. If you hit problems, just ask.
snibgo's IM pages: im.snibgo.com
Post Reply