Name: Anonymous 2013-09-13 22:12
Just finished this script because I needed to split a bunch of manga images in half vertically. Spent like two hours on it. Works perfectly though, and even only does it for images greater than 1200 pixels wide which are the ones that are joined and leaves the others alone.
Feels good man. I thought it might be useful to anyone else who downloads manga where some dude scanned both pages.
Feels good man. I thought it might be useful to anyone else who downloads manga where some dude scanned both pages.
#!/bin/bash
mkdir out
for a in *.jpg; do
if (( $(identify -format "%w" "$a") > 1200 ))
then convert "$a" -crop 50%x100% ./out/"${a%.jpg}".jpg;
else cp "$a" ./out
fi; done
#ImageMagick renames the left half of the crop to end with 0, need the right half alphabetically first.
cd out
for b in *-0.jpg; do
mv "$b" "./${b%.jpg}"2.jpg; done