Created
February 8, 2019 02:00
-
-
Save AnyTimeTraveler/3d51952d09da95daf1de9bfe1fb80ae7 to your computer and use it in GitHub Desktop.
A simple script that uses imagemagick to turn a series of files into a gif.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$#" -lt 3 ]; then | |
echo "Usage: [speed] [output file name] [files...]" | |
exit -1 | |
fi | |
mkdir gif | |
cd gif | |
echo -n "Copying..." | |
for ((i = 3; i <= $#; i++)); do | |
cp ../${!i} ./ | |
done | |
echo "Done" | |
echo -n "Resizeing..." | |
convert ./* -resize 1000x frame.png | |
for ((i = 0; i <= $# && i <= 9; i++)); do | |
mv frame-$i.png frame-0$i.png | |
done | |
echo "Done" | |
echo -n "Giffing..." | |
convert ./frame-* -delay $1 animation.gif | |
echo "Done" | |
echo -n "Cleaning up..." | |
mv ./animation.gif ../$2 | |
cd .. | |
rm -r ./gif/ | |
echo "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For help with the speed, check this: http://www.imagemagick.org/script/command-line-options.php?#delay
An example command could be:
./giffer.sh 1x10 out.gif in-0.jpg in-1.jpg in-2.png inputfile-3.jpg [...]