Paco Hope My Random Musings and Rants

14Nov/04Off

Animated GIF Icons from QuickTime Movies

I put movies in my photo gallery (I use a program called Gallery for it), but I want an icon that indicates that it is a movie, not just an image. The Gallery software puts a really ugly movie icon in, and all movies get the same icon. I have a straightforward (albeit baroque and UNIX-ish) process for making an animated GIF icon.

Here's how I make an animated GIF. I use QuickTime Pro and ImageMagick.

The Process

  1. Use QuickTime Pro to save your movie as a series of images. I
    chose PNG format images, 256 colors, 1 frame per second. To get less than a frame per second, use fractions like 0.1 or something.

  2. I had too many images (about 30 or 40 is probably all you really
    want). I did various things like rm *[2,4,6,8,0].png to remove lots of
    frames. (that removed all the even numbered frames)

  3. Then I run a snippet to zero-fill the file names that have only 1
    digit. Annoying. This is bash syntax, not
    even /bin/sh, must be bash. All my frames were named
    munch*.png:

    for i in munch?.png
    do
       mv $i munch0${i#munch*};
    done

  4. Another snippet for doing the file names that have only 2
    digits.

    for i in munch??.png
    do
       mv $i munch0${i#munch*};
    done

  5. Now convert all the PNGs to GIFs. The convert program is part of
    ImageMagick:

    for i in *.png
    do
      convert -scale 100x84 $i ${i%.png}.gif
    done

  6. Now choose one to be the final frame you'll animate and
    give it a unique name: mv munch099.gif final.gif
    It needs to have a unique name so we can give it a unique delay.
    We'll indicate that it is supposed to be animated longer than the others.

  7. Now roll all those GIFs into an animation:

    convert -delay 20 -loop 0 munch*.gif -delay 2000 final.gif bigloop.gif

The -loop 0 means loop forever. You could also do -loop
1
or -loop 2. The delay number is in tenths of a
second. All the first frames are animated at 200ms (-delay
20
). The last frame gets -delay 2000 so that it pauses 20 seconds
before restarting. I used a high inter-frame delay (200ms) because I
was animating so few frames. I ended up with about a180K animated GIF
thumbnail.

Integrating with Gallery

Interestingly, you can then install this file
as MovieName.thumb.jpg and it will still work. Browsers don't
seem to care that the file is named .JPG but is actually an animated
GIF. It still works.

Filed under: MacOS Comments Off
Comments (0) Trackbacks (0)

Sorry, the comment form is closed at this time.

Trackbacks are disabled.