Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 24 lines (23 sloc) 0.581 kB
#!/bin/bash
FILENAME=$1
HEIGHT=`identify -format "%h" "$FILENAME"`
WIDTH=`identify -format "%w" "$FILENAME"`
echo $HEIGHT
echo $WIDTH
TARGETHEIGHT=0
TARGETWIDTH=0
COMPAREWIDTH=$(($HEIGHT * 2 / 3))
if [ $WIDTH -gt $COMPAREWIDTH ]
then
TARGETWIDTH=$WIDTH
TARGETHEIGHT=$(($WIDTH * 3 / 2))
else
TARGETHEIGHT=$HEIGHT
TARGETWIDTH=$(($HEIGHT * 2 / 3))
fi
echo $TARGETHEIGHT
echo $TARGETWIDTH
x="x"
suffix=".converted.tif"
echo $TARGETWIDTH$x$TARGETHEIGHT
convert "$FILENAME" -gravity center -crop $TARGETWIDTH$x$TARGETHEIGHT-0-0\! -background black -flatten "$FILENAME"$suffix
Jump to Line
Something went wrong with that request. Please try again.