2024-09-30 Web Development
Create a GIF file from jpegs
By O Wolfson
To create a GIF file running at 5 frames per second from a series of JPEG images named image001.jpg
, image002.jpg
, image003.jpg
, etc., using ffmpeg, you can use the following command:
Here's a step-by-step explanation of the command:
-framerate 5
: This sets the frame rate to 5 frames per second.-i image%03d.jpg
: This specifies the input files. Theimage%03d.jpg
pattern means that the input files are namedimage001.jpg
,image002.jpg
,image003.jpg
, and so on.%03d
is a placeholder for a 3-digit number, ensuring the correct sequence.-vf "scale=iw:-1"
: This applies a video filter to scale the images.iw
is the input width, and-1
maintains the aspect ratio of the images.output.gif
: This is the name of the output GIF file.
Run this command in the terminal or command prompt where your images are located. This will generate the GIF with the specified frame rate and maintain the aspect ratio of the images.