Skip to content

Instantly share code, notes, and snippets.

@probil
Created June 24, 2016 09:15
Show Gist options
  • Save probil/074743f08a34ae610d7dbe987b246bbf to your computer and use it in GitHub Desktop.
Save probil/074743f08a34ae610d7dbe987b246bbf to your computer and use it in GitHub Desktop.
#!/bin/bash
# This script will find all *.gif in current directory
# and convert in to max height with aspect ratio and
# apply maximum optimization.
# ============================
# You need to install `gifsicle` first
# Create dir if not exists
if [ ! -d "$DIRECTORY" ]; then
mkdir "./resize/"
fi
for f in `find . -name "*.gif"`
do
filename="${f##*/}"
dirn="${fspec%/*}"
result_path="./resize/${filename}";
# print current file name
echo $f
# do conversion
gifsicle --resize-fit-height 60 -O3 -i $f > $result_path
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment