Convert images to gif

Convert images to gif

#!/bin/bash

# input images pattern
input_images="*.png"
output_gif="output.gif"
# delay between frames (100 = 1 second)
delay=100
# loop forever (0), or specify number of loops
loop=0
# create GIF using ImageMagick's convert
convert -delay $delay -loop $loop $input_images $output_gif

examples

convert -delay 20 -loop 0 "*.jpeg" output.gif
convert -delay 20 -loop 0 1.jpeg 2.jpeg output.gif
  • convert: ImageMagick command for image conversions.
  • -delay: Sets the time each frame is displayed, measured in hundredths of a second.
  • -loop: Determines how many times the GIF loops. 0 means it loops indefinitely.
  • input wildcard (*.png or another format) to select multiple images in the same directory.

12. Oct 2024