Advertisement
Guest User

MTG Card Printer

a guest
Oct 18th, 2014
408
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.65 KB | None | 0 0
  1. #!/bin/bash
  2. ## Setup your cards, one per line in a file named 'cards.txt'
  3. outdir="output"
  4.  
  5. echo "Downloading `wc -l cards.txt` cards"
  6. while read line
  7. do
  8.   wget "http://mtgimage.com/card/$line.jpg"
  9. done < cards.txt
  10. echo "Download complete"
  11.  
  12. mkdir $outdir
  13.  
  14. echo "Creating printable sheets in $outdir"
  15. image_files=(*.jpg)
  16. n=9                 # number of images per sheet
  17. for ((i=0; i < ${#image_files[@]}; i+=n)); do
  18.   montage -geometry 709x1006+20+20 -background "#ffffff" "${image_files[@]:i:n}" $outdir/output-"$i".jpg
  19.   convert $outdir/output-"$i".jpg -bordercolor '#ffffff' -border 75x124 -gravity center $outdir/output-"$i".jpg
  20. done
  21. echo "Done."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement