Skip to content

Instantly share code, notes, and snippets.

@bastibeckr
Created September 20, 2017 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bastibeckr/7dd2d93c45cebfb649c6cdff250b3353 to your computer and use it in GitHub Desktop.
Save bastibeckr/7dd2d93c45cebfb649c6cdff250b3353 to your computer and use it in GitHub Desktop.
gifsicle resize
#! /bin/zsh
sizes=( "100x56" "1024x576" "150x150" "150x80" "200x125" "250x140" "256x144" "300x169" "320x180" "400x225" "600x338" "768x432" "800x450" )
filename=${1}
echo "Filename: ${filename:r:t}"
# Dirname without trailing slash
dirname=$(dirname ${filename});
for size in "${sizes[@]}"
do
# Filename with extension WITHOUT dirname
targetfile="${dirname}/${filename:r:t}-${size}.gif";
gifsicle --resize ${size} ${filename} > ${targetfile};
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment