Home > Uncategorized > reprocess animated GIfs

reprocess animated GIfs

Given an animated GIF file, foo.gif, the following can be done with simple Linux/Unix commands:

Split it into individual frames, with:
mogrify -format png foo.gif

Convert the above PNGs back to GIFs, with:
for f in *png; do convert $f $f.gif; done

Create an index for the above GIFs, with:
: > test.inc; for ((i=0; i<201; i++)); do echo `pwd`/cat-and-dog-$i.png.gif >> test.inc; done
provided that the number of GIFs created with mogrify is 200

Create a new animated GIF, with:
./whirlgif -time 1 -minimize -loop -o test.gif -i a/test.inc

To create animated GIFs in the first place:
a='yes'; for f in *gif; do if [[ "$a" == "no" ]]; then a='yes'; else echo $PWD/$f; a='no'; fi; done > test.inc

Advertisements
Categories: Uncategorized Tags: ,
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: