Last active
April 22, 2016 11:06
-
-
Save e-minguez/31929c85898316e4b2e7 to your computer and use it in GitHub Desktop.
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 | |
mkdir -p {images,final} | |
cd $1 | |
for i in *.pdf | |
do | |
convert -density 400 -flatten ${i} ${i}.png | |
convert ${i}.png -crop 2550x1780+375+200 -resize 50% ${i}_ok.png | |
rm -f ${i}.png | |
convert ${i}_ok.png -shave 1x1 -bordercolor black -border 1 images/${i}.png | |
rm -f ${i}_ok.png | |
done | |
cd images | |
files=$(ls | head -n8) | |
j=1 | |
while [ -n "${files}" ] | |
do | |
montage -mode concatenate -tile 2x8 ${files} ${j}.png | |
convert -density 300 -page A4 ${j}.png ../final/${j}.pdf | |
rm -f ${files} ${j}.png | |
((j++)) | |
files=$(ls *.png | head -n8) | |
done | |
cd .. | |
rm -Rf images/ | |
cd .. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment