Created
May 3, 2012 22:02
-
-
Save igungor/2589858 to your computer and use it in GitHub Desktop.
Manga converter for Kindle screen
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/bash | |
if [ ! -x $(which gm) ] | |
then | |
echo "GraphicsMagick is required." | |
exit 1 | |
fi | |
TMPDIR=$(mktemp -d) | |
for file in * | |
do | |
resolution=($(gm identify -format "%w %h" "$file" 2>/dev/null)) | |
if [ $? -eq 0 ] # Make sure if it's a valid image. | |
then | |
cp "$file" $TMPDIR/ | |
gm convert -rotate "-90>" "$TMPDIR/$file" "$TMPDIR/$file" | |
gm mogrify -depth 4 -colorspace gray -type palette -geometry x800 "$TMPDIR/$file" | |
fi | |
done | |
zip $(basename $(pwd)).cbz $TMPDIR/* > /dev/null | |
rm -r $TMPDIR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment