In this first tutorial, we will see how to assemble images into a strip, using the command line tool ffmpeg, a powerful tool for manipulating videos, images and audio.
Here is a video describing the process :
There are several ways to install ffmpeg, depending on your operating system.
Here’s a useful link for installing it on main operating systems :
https://trac.ffmpeg.org/wiki/CompilationGuide
More info about ffmpeg at https://ffmpeg.org.
Operating system used in this tutorial : MacOS Catalina.
Here is one easy way to install ffmpeg on macOS :
- Install homebrew. More info at https://brew.sh.
- Install ffmpeg :
Open the Terminal application, and type the following command :
brew install ffmpeg
– Sample command to create a horizontal strip :
(important : The images must have the same height *)
ffmpeg -i 004.png -i 001.png -i 003.png -i 002.png -filter_complex hstack=inputs=4 output.png
(The ‘inputs’ variable corresponds to the number of images)
– Sample command to create a vertical strip :
(important : The images must have the same width **)
ffmpeg -i 004.png -i 001.png -i 003.png -i 002.png -filter_complex vstack=inputs=4 output.png
(The ‘inputs’ variable corresponds to the number of images)
* Sample command to change the height of an image to 400 pixels while preserving its aspect ratio :
ffmpeg -i 001.jpg -vf "scale=-1:400" output_resized_height.jpg
** Sample command to change the width of an image to 400 pixels while preserving its aspect ratio :
ffmpeg -i 001.jpg -vf "scale=400:-1" output_resized_width.jpg
Enjoy !