Prabhakar Kasi iOS Developer, Front End Developer

Create gifs from still photos using ImageMagick

45 sec read

Use ImageMagick to create GIFs from Photos

If you want to create gifs from sequence of photos just like how modern photo-booth does, here is a quick command line tool that gets the job done.

Setup

  1. Install homebrew – https://brew.sh/
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

# Once installation completes, read the closing notes. It might ask you run few commands like this.
    echo '# Set PATH, MANPATH, etc., for Homebrew.' >> /Users/pkasi/.zprofile
    echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> /Users/pkasi/.zprofile
    eval "$(/opt/homebrew/bin/brew shellenv)"
  1. Install ImageMagick – https://imagemagick.org/script/download.php
brew install ImageMagick
brew install ghostscript
  1. Run the tool to create gifs from photos

Earlier the command was convert now both convert and magick works

# Switch to the directory that has multiple jpg or png
convert *.png selfie-nov-2022.gif
  (OR)
magick *.png selfie-nov-2022.gif

You can using -delay options to control the speed of image switching and -quiet to suppress all warning that gets logged in the terminal. Read more about different options here

magick -delay 50 *.png selfie-nov-2022.gif
magick -quiet -delay 100 selfie-dec-2022.gif
GIF created using 4 photos
convert -delay 150 *.jpg imagemagick-nov-2022.gif

Reference

  1. https://imagemagick.org/script/convert.php
Prabhakar Kasi iOS Developer, Front End Developer

Leave a Reply