Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Guillotine Script for all layers
#1
I have downloaded a deck of playing cards that has been printed to 151 pdf files, each with 9 cards printed in a 3x3 grid.  I need to separate each card on all of the PDFs into separate images, so I can send each individual card image to a card deck printer.  I have gotten as far as combining all pdf files into a single PNG, with each 3x3 page as a separate layer.  I have setup guillotine and/or web slice to pull apart the pictures correctly on the first layer.  Is it possible to script either of these so they cut the same 3x3 grid out of all 151 layers and save each individual card as a seaparate .jpg?
Reply
#2
I think for something like that I would use the command line application ImageMagick http://www.imagemagick.org

Starting with the PDFs in a 'clean' project folder. Start your terminal there. I am just using 2 PDF as an example.

1. Convert the PDfs to pngs - the 300 is for 300 ppi %03d is the file name 000.png etc
Code:
magick convert -density 300 *.pdf %03d.png

screenshot: https://i.imgur.com/8hWcTQ1.jpg

2. Check the size of the png image for dividing into 3x3
Code:
magick identify 000.png

screenshot: https://i.imgur.com/nPfecpR.jpg

3. Dividing those sizes by (900x1200) 3 to get a command to get individual parts (300x400) as jpeg images
Code:
magick convert *.png -crop 300x400 tile-%04d.jpg

screenshot: https://i.imgur.com/jiGgcfd.jpg
Reply
#3
Another solution with ofn-tiles:

1) Use ofn-tiles to load the PDFs
2) Use ofn-tiles giving the card size, to export the cards to individual files

Potential hazards:
  • Never tested with PDFs
  • Loading the 151 PDFs together can result in a huge image size, but there may be a number of loaded PDF which is a good compromise between memory use and number of repetitions.
Reply


Forum Jump: