54

I have an animated gif which, as originally created, animates once then stops. I want to modify the image file so it loops forever instead.

What free applications or command-line utilities for Mac OS X can I use to do this? I've found several GIF utilities that can create new animations, but none that let me tweak the properties of existing ones.

4
  • Bear in mind that it also depends on the application you are using to display the animated GIF. For example, Firefox's display of animated GIFs can be changed through <code>about:config</code>: <code>image.animation_mode = normal | once | none</code> Jul 1, 2010 at 23:56
  • 1
    do you want it to loop permenantly, so that you will change the file? Or do you want to change a setting locally on your computer to make this work?
    – Daisetsu
    Jul 1, 2010 at 23:59
  • I want to modify the file, not the app displaying it. I'll edit the question to clarify. Jul 2, 2010 at 15:15
  • Related: Make a GIF 'video'.
    – kenorb
    Dec 25, 2015 at 20:13

6 Answers 6

34
+50

Solution involving the Terminal:

  1. Download the sources of Gifsicle
  2. Unpack the sources and go to the unpacked directory
  3. Do ./configure --disable-gifview --disable-gifdiff
  4. Do make
  5. Do cd src
  6. And finally do ./gifsicle -bl /path/to/image.gif

Solutions using GUI tools (I didn't test any them!):

  1. You can try GifBuilder (requires Rosetta to work with Snow Leopard).
  2. Pixen also seems to be a GIF Editor.
5
  • 1
    Gifsicle is definitely the tool for the job. I found it so useful I build a install pkg with binaries for easy deployment, no XCode required. dept.psych.columbia.edu/~peter/gifsicle
    – notpeter
    Dec 15, 2011 at 7:18
  • @notpeter How do you use this once you've installed it?
    – Mazatec
    Aug 17, 2012 at 23:32
  • 3
    to expand on your answer, here's what worked for me: first install with Homebrew like a boss: brew install gifsicle then make the loop: gifsicle -l non_looping.gif > looping.gif
    – Michael
    Sep 12, 2014 at 14:03
  • Thanks Michael, your suggestion works great (brew install gifsicle then make the loop: gifsicle -l non_looping.gif > looping.gif) Aug 1, 2015 at 21:06
  • With homebrew on Mac you can just do brew install gifsicle Oct 6, 2016 at 17:27
54

You can use ImageMagick. You just run:

convert -delay 20 -loop 0 nonloopingImage.gif loopingImage.gif

You may need to install ImageMagick first.

If you use brew you can: brew install imagemagick from the terminal, then you can run the convert command.

5
  • 3
    Not preinstalled on mine, a 2014 MBP running OS 10.11. Had to brew install imagemagick.
    – user274720
    Oct 12, 2015 at 3:39
  • imagemagick ftws Jan 30, 2017 at 19:04
  • 1
    If you don't want the gif to loop, use -loop 1
    – Flimm
    Mar 30, 2018 at 8:01
  • 2
    Works like a charm! Worth noting that -delay <number> may slow down the gif by adding a delay between each frame. imagemagick.org/script/command-line-options.php#delay
    – mLuby
    Apr 4, 2018 at 16:48
  • 3
    Is delay required? If so, why? If not, probably remove it Apr 17, 2018 at 6:04
9

GIMP can edit animated GIFs; open the image in that then save it again. You will be asked a few questions, and one of the available options is to loop forever.

It is apparently possible, or even easy, to install GIMP on OS X, but I can't say I've done it,

8

Assuming you already installed Homebrew and run brew install imagemagick.

Just use the command line to do:

convert -delay 15 -loop 0 input.gif output.gif

And this edits your existing image without modifying the existing durations:

mogrify -loop 0 Untitled.gif
1
  • Sidenote: use licecap on macOS to take animated screenshots. Feb 11, 2017 at 21:26
3

See Michael's Animated GIFs guide.

It describes the GIF Construction Set utility that can display the internal structure of the animated GIF (unfortunately not for OS X). Especially of interest is:

The LOOP control specifies how many times the series of images will be presented. While many animated GIFs are on infinite loop, this can be distracting to the user. This 'noframes' GIF cycles 5 times.

image

It's harder to find free OS X utilities for editing GIF files, especially since I'm not a Mac user. One that seems to fit the bill is Gifsicle, which can set the loop through the "loopcount" parameter.

2

If you came here for making this change on a PC like I did, GIMP is a great option. A N Other's response is a good one-- here are some specifics to add to their answer.

  1. Open your animated gif in GIMP
  2. Click File > Export As... optionally change the name and click "Export"
  3. Select "As Animation", then check the box "Loop Forever". Click "Export" again

The nice thing about GIMP compared to the other options above is you don't have to write any code or commands-- it's all built in and free. Hope this helps!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .