Skip to content

Instantly share code, notes, and snippets.

@AnyTimeTraveler
Created February 8, 2019 02:00
Show Gist options
  • Save AnyTimeTraveler/3d51952d09da95daf1de9bfe1fb80ae7 to your computer and use it in GitHub Desktop.
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.
#!/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!"
@AnyTimeTraveler
Copy link
Author

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 [...]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment