Skip to content

Instantly share code, notes, and snippets.

@pix0r
Created January 29, 2010 19:41
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 pix0r/290035 to your computer and use it in GitHub Desktop.
Save pix0r/290035 to your computer and use it in GitHub Desktop.
split a 3200x1200 image into left and right parts
#!/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