Created
March 29, 2021 15:15
-
-
Save joaonsantos/1e4ad2d53a31076eca70e3d59f3a4177 to your computer and use it in GitHub Desktop.
Create a gif from any file
This file contains 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 | |
set -e | |
# In case there is no args given | |
if [ $# -lt 2 ] | |
then | |
echo "usage: $0 <input> <output>" | |
exit 1 | |
fi | |
echo "Starting conversion to gif" | |
echo "Please wait a moment..." | |
echo "" | |
ffmpeg -v error -y -i $1 -pix_fmt rgb8 $2 | |
name="`echo "$2"|cut -d. -f1`" | |
gifsicle --optimize=3 --output "${name}-opt.gif" --resize-height 720 $2 | |
echo "Success!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For clarity:
This script creates a gif and optimizes it, optimized gif is named
<output-name>-opt.gif
.For example:
outputs
output.gif
andoutput-opt.gif
.