Last active
May 23, 2018 20:31
-
-
Save tenkabuto/4059f3aadafc0c3692e17e3663ae6f8a to your computer and use it in GitHub Desktop.
Requires ImageMagick and pdftk. Produced by @court-jus. Takes an 8 page PDF and transforms it into a PocketMod booklet! Found at: https://boardgamegeek.com/thread/803592/best-way-make-pocketmod
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 | |
filename=$1 | |
basefilename=$(basename ${filename}) | |
tmpdir=$(mktemp -d -t) | |
cp ${filename} ${tmpdir}/ | |
cd ${tmpdir} | |
pdftk ${basefilename} burst | |
for file in pg*pdf; do convert -density 300 ${file} ${file/pdf/jpg}; done | |
# Upside down first for fold on top | |
montage pg_000{1,2,3,4}.jpg \ | |
-rotate 180 pg_000{5,6,7,8}.jpg \ | |
-geometry 2480x3508+0+0 output.jpg | |
cd - | |
convert -density 300 ${tmpdir}/output.jpg your_pocketmod_output.pdf | |
rm -rf ${tmpdir} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment