Created
January 29, 2010 19:41
-
-
Save pix0r/290035 to your computer and use it in GitHub Desktop.
split a 3200x1200 image into left and right parts
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/sh | |
IMAGE=$1 | |
EXT=`echo $IMAGE | sed -e 's/.*\(\.[A-Za-z0-9]*\)$/\1/'` | |
BASE=`echo $IMAGE | sed -e 's/^\(.*\)\(\.[A-Za-z0-9]*\)$/\1/'` | |
LEFT_IMAGE="$BASE-left$EXT" | |
RIGHT_IMAGE="$BASE-right$EXT" | |
if [ "$IMAGE" = "" ]; then | |
echo "Usage: $0 image.jpg" | |
echo " (image.jpg must be 3200x1200 pixel JPEG image)" | |
exit | |
fi | |
if [ ! -f $IMAGE ]; then | |
echo "$IMAGE does not exist" | |
exit | |
fi | |
convert -crop 1600x1200+0+0 $IMAGE $LEFT_IMAGE | |
convert -crop 1600x1200+1600+0 $IMAGE $RIGHT_IMAGE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment