Created
February 27, 2011 01:12
-
-
Save koichiro/845804 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/zsh | |
# pdf/の下に全PDFファイルを入れてから実行する。 | |
# いつもの自炊系ツールに加えて、zipコマンドが必要。 | |
# (c)tdtds | |
mkdir pgm jpg zip | |
for pdf in pdf/*.pdf; do | |
echo $pdf | |
base=`basename $pdf _hq.pdf` | |
pdftoppm -r 300 -gray $pdf pgm/${base} | |
for pgm in pgm/${base}*.pgm; do | |
echo " ${pgm}" | |
convert $pgm -resize x800 -level '0%,100%,0.5' jpg/`basename ${pgm} .pgm`.jpg | |
done | |
zip zip/${base}.zip jpg/${base}*.jpg | |
done |
This file contains hidden or 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/zsh | |
# zip/の下に全zipファイルを入れてから実行する。 | |
mkdir jpg jpg2 zip2 | |
rm -f jpg/* | |
rm -f jpg2/* | |
for zip in zip/*.zip; do | |
echo $zip | |
base=`basename $zip .zip` | |
unzip -d jpg -j $zip | |
for jpg in jpg/*(.jpg|.JPG); do | |
echo " ${jpg}" | |
convert "$jpg" \ | |
-resize '600x800' \ | |
-type Grayscale \ | |
-level '0%,100%,0.5' \ | |
-fuzz 50% -trim -quality 100 \ | |
"jpg2/`basename $jpg`" | |
done | |
zip zip2/${base}.zip jpg2/*(.jpg|.JPG) | |
rm -f jpg2/* | |
rm -f jpg/* | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment