Skip to content

Instantly share code, notes, and snippets.

@freundTech
Last active July 2, 2016 19:00
Show Gist options
  • Save freundTech/c8dd85384cb7b26dc1e595b4c09f6629 to your computer and use it in GitHub Desktop.
Save freundTech/c8dd85384cb7b26dc1e595b4c09f6629 to your computer and use it in GitHub Desktop.
Blubb-image-converter
#/bin/bash
if [ ! -d "output" ]
then
mkdir "output"
fi
if [ ! -d "output/thumb" ]
then
mkdir "output/thumb"
fi
for f in $@
do
if [ -f $f ]
then
filename=$(basename "$f")
test=`convert "$f" -format "%[fx:(w/h>1)?1:0]" info:`
if [ $test -eq 1 ]; then
convert "$f" -resize 700x "output/$filename"
convert "$f" -resize x48 -crop 72x48 "output/thumb/$filename"
else
convert "$f" -resize x467 "output/$filename"
convert "$f" -resize 72x -crop 72x48 "output/thumb/$filename"
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment