How to batch combine JPEG's from folders into PDF's

On OS X

With Homebrew it's a snap to install ImageMagick:

brew install imagemagick

convert *.jpg output.pdf

and if the resulting PDF is a bit too big you can try:

convert -quality 60 *.jpg output.pdf

Linux, Unix, Windows

Of course ImageMagick can also be installed on other Unix systems, e.g. apt-get install imagemagick on Debian and Ubuntu. And even on Windows through GNU/Cygwin or Chocolately.


OS X has several tools built in to automate image processing and PDF creation.

Just open up Automator.app, create a new Application.

Automator.app

Change it as shown below, by dragging the actions from the left pane to the right one.

Step one

  • Get Folder Contents with the Repeat… option enabled will get all your files, even from within the subdirectories.

  • New PDF from Images will create one PDF file on the desktop, each page consisting of one image.

Save the app somewhere (e.g. under /Applications or on your Desktop). Give it a proper name, like "Create PDF from Image.app". Then, you can drag your folders on its icon. Let the workflow do the job for you.


The above creates one single PDF file for all images. If you want to have one for each folder, that's going to be more complicated.

First, you need the Dispense Items Incrementally action. Install it. Then, open Automator again, and create a new Workflow (not an application).

Now, for convenience, you can download the workflow here. In case that link breaks, just change it as shown below:

Workflow screenshot

Or, in text form:

  • Get Selected Finder Items
  • Dispense Items Incrementally (the one we installed before)
  • Set Value of Variable, to remember the folder we're in
  • Get Folder Contents, to get the images
  • New PDF from images, to create the PDF. Here, take the variable from the "Variables" panel at the bottom and drag it to the "Save Output to…" field. This makes sure the PDF is created in the folder it belongs to. There's no easy way to rename the file other than setting a static file name. You could add a Rename Finder items action to set it though.
  • Loop, to begin from start and run with the next folder. You can disable the part where it asks for confirmation.

Save it as a Workflow, and now, here's how to execute it. Select your folders in Finder.

Finder screenshot

Then, go to Automator.app and click Run in the top right corner.


With 500 folders, that might take a while. Especially with high resolution pictures, your PDF might become huge. But you can try it on a smaller selection first and then let the workflow run until it's finished.


A more simple way is to view all the images in Preview, then print to PDF, very quick.

http://hints.macworld.com/article.php?story=20090119162659107