Magazine Split

This is a simple python script I wrote that takes a bunch of scans from a disassembled magazine, cuts them in half, and reassembles them into a PDF with the pages all in the right order. It’s not terribly robust, but I thought it might save somebody some time.

Example: I have an 8 page brochure. I take the staples out, and feed the whole thing through a scanner that produces four files:

  1. Front and back cover (page 1 and page 8)
  2. Page 2 and page 7
  3. Page 3 and page 6
  4. Page 4 and page 5

This script will cut each of those files in half, order them properly, and then shove the whole thing into a single PDF file. This was a quick hack I wrote to automate converting 50+ years of a monthly magazine into PDFs with the help of work’s high speed sheet-fed scanner. I don’t promise it works for everyone, but should form a good starting point if you’re looking to do something similar.

It’s a python script. Arguments:
-i (input directory)
-o (output directory)
-p (PDF filename)

The files in (input directory) should be named such that they sort into “natural” page ordering, and should end in “.jpg” or “.tif”. They’ll be processed into individual page images in (output directory), named page-0000.jpg (where obviously 0000 is a sequence number). If the PDF option is specified, it will then create a PDF file from those output pages in the output directory.

It needs either imagemagick’s or graphicsmagick’s convert utility installed on the system and in the path.

Example usage:
python -i ~/inputdir ~/outputdir -p booklet.pdf

The source code can be found here on Github.