Marius Hauken is a designer and partner at Stacc X, Bergen Norway.

How to create pdf from images

Now and then I find myself in the situation where I need to create a pdf from some images. I often resort to Preview, but it can be quite cumbersome at times. There is however an easier and faster option, but it requires that you use the Terminal.

Images to pdf step by step

  1. First you need Homebrew, which is basically the app store for Terminal. If you don’t have it installed open up your terminal and paste in /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" and press enter. Then follow the instructions in Terminal.
  2. Once done close your terminal and open it up again (to make sure that Homebrew works)
  3. Then type in brew install imagemagick. This installs imagemagic which is the program that will help us create the pdf-files.
  4. When finished close and open up your Terminal again.
  5. Next step is to find the folder where we have the source images we want converted. The easiest way to do that is to find the folder in Finder. Then in your Terminal type in cd and then drag your folder into your Terminal window. Now it will read cd Downloads/images or something similar. Then press enter. Now we have navigated to a new folder in Terminal!
  6. Type in convert *.jpg output.pdf which means use imagemagick to convert all jpg-files in this folder and combine them to a pdf called output.pdf. You can adjust this if you f.ex. have png-files, or create your own name on the pdf: convert *.png myAwesomeFile.pdf.
  7. You now have a pdf-file with all your images combined!

ProTip 1

If you want the file in a specific order I recommend naming your files with numbers. F.ex: 1-onboarding.png, 2-signing.png. You can also type your files directly out like convert onboarding.png signing.png output.pdf

ProTip 2

If the resulting pdf is too big in size you can try: convert -quality 60 *.jpg output.pdf

Tl;dr

To convert images to pdf:

  1. brew install imagemagick
  2. convert *.jpg output.pdf

Source