Last active
September 6, 2017 15:29
-
-
Save tylerpaige/af4ecf59740f5316309bf4063ce39652 to your computer and use it in GitHub Desktop.
Remove every n frames of gif
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 | |
# This script will remove every n frames an GIF | |
# Usage: ./frame-count-reduction.sh input.gif n output.gif | |
input=$1 | |
divider=$2 | |
output=$3 | |
numOfFrames=eval gifsicle master.gif -I | grep -E -o "[0-9]+ images" | grep -E -o "[0-9]+" | |
numOfFramesInclusive=$((numOfFrames - 1)) | |
gifsicle $input ` | |
for ((a=0; a <= $numOfFramesInclusive ; a++)) | |
do | |
if [ $(($a % $divider)) != 0 ] | |
then | |
echo "#$a" | |
fi | |
done | |
` -O3 -o $output | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment