I have a about 500 folders with images inside. Is there a way I could batch convert this so that I get .pdf files that contain all images inside as pages?


There should be 500 PDF's created, each with the name of the containing folder, and each having images within it as pages.

  • 3
    what OS? and do you want a CLI or GUI tool? Are the files named in a sane or consistant way, and is the order important? – Journeyman Geek Nov 29 '11 at 1:18
  • Mac OS X, it can be any sort of tool and I do own Acrobat Pro but I don't find that option. Files are alphabetically organised and I'd like to maintain that order. Thanks – Ska Nov 29 '11 at 1:44

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

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


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.

  • Amazing, however all the images are now in one PDF. Is it possible to make a separate PDF for each containing folder? I wasn't even aware of what all you can do with Automator, thanks a ton! – Ska Nov 29 '11 at 15:22
  • @Ska See my updated answer. Hope it works for you. This is where it gets tricky in Automator and where you'd think about rather moving to AppleScript or a simple Bash script in combination with AppleScript. – slhck Nov 29 '11 at 16:09
  • Don't worry, I'll rename them later with bash script. However, wouldn't it be possible to create an Application which would pass the output of Get Folder Contents (folder name) and create a variable out of it? – Ska Nov 29 '11 at 16:49
  • @Ska yes, that's how you set the variable, but you can't use the variable in the output name of the PDF. At least not in an easy way. – slhck Nov 29 '11 at 16:53
  • That is an awesome workflow. Thanks for the help on this. I have spent the past week decrypting JPGs of every issue of National Geographic back to the beginning of time and needed a way to convert all 250,000 pages to PDFs so that I can OCR them and make them searchable. You just saved me a ton of manual labor. One change I had to make on the script was to set a time out period greater than the default 0 minutes. Otherwise it only created one PDF. I did it with the manual loop, but that is way too much involvement in an automated process. I also told it to save them to a single folder so that – user130916 Apr 28 '12 at 22:01


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.

  • 3
    Way faster than fidgeting with Preview! – DK_ May 20 '14 at 5:46
  • 1
    +1 I think the comparison between this and the accepted answer really shows the power of command line tools (and especially imagemagick) in this sort of situation! – Bill Cheatham Sep 10 '14 at 17:25
  • 1
    This is also possible in windows. If you are using chocolatey (package manager for windows): choco install imagemagick.tool, and then follow @KasperSouren's "convert" commands. – Giscard Biamby Apr 12 '15 at 14:59

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



On almost any system you'd be running this on your best solution may be ImageMagick. Available on *nix, Mac and Windows, supports both wildcarding (aka filename globbing) and specification of a list (e.g. @ImagesToProcess.txt) of input files, some advanced file specification options, a powerful command line, etc.

  • It would also require GhostScript and me doing the programming with who knows how many dependency management. I would assume there could be a simple tool that does that. After all the use case is rather simple. – Ska Nov 29 '11 at 1:51
  • It shouldn't be that difficult - as long as you have both ImageMagick and GhostScript installed and ImageMagick able to find GS, you can just use the IM command line which makes it simple to script. This assumes that filename globbing will handle files in the correct order, but if not then it's going to be more complex anyway. For Windows, here's one guide to getting them working together: stackoverflow.com/questions/3243361/… . Still, the other answer is better for Macs – fencepost Nov 29 '11 at 14:27
  • Thanks for the awesome tips on IM, fencepost. You learn something new everyday. As for the original question, I will try the slhck's solution first. – Ska Nov 29 '11 at 15:06
  • You're quite welcome. I posted not realizing that A) you were using a Mac and B) Ghostscript support on Macs is apparently significantly weaker for some reason - or at least it hasn't kept up with Windows and *nix. – fencepost Nov 30 '11 at 4:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.