Skip to content

Instantly share code, notes, and snippets.

@mschmitt
Created September 5, 2011 18:04
Show Gist options
  • Save mschmitt/1195573 to your computer and use it in GitHub Desktop.
Save mschmitt/1195573 to your computer and use it in GitHub Desktop.
Crop foo for double-spread comic scans
#!/bin/sh
FILE=$1
echo $FILE
WIDTH=$(identify $FILE | awk '{print $3}' | awk -F x '{print $1}')
HEIGHT=$(identify $FILE | awk '{print $3}' | awk -F x '{print $2}')
HALFWIDTH=$(expr $WIDTH / 2)
LEFT=$(echo $FILE | sed 's/.jpg$/.l.jpg/i')
RIGHT=$(echo $FILE | sed 's/.jpg$/.r.jpg/i')
convert $FILE -crop "${HALFWIDTH}x${HEIGHT}+0x0" $LEFT
convert $FILE -crop "${HALFWIDTH}x${HEIGHT}+${HALFWIDTH}x0" $RIGHT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment