How to merge JPEGs into a PDF using Homebrew ๐Ÿบ and ImageMagick on OS X

Ever wanted to merge a collection of images into a .pdf file? Websites can do this for you but are never intuitive to navigate and have restrictions on its use due its potential of being misused. In this article we explore an easy method of doing locally on your own machine within terminal on MacOS.

For this we are going to have to use 2 powerful tools called Homebrew ๐Ÿบ and ImageMagick.

Install Homebrewย ๐Ÿบ

Homebrew is a package manager that we will to deploy to accomplish the main goal here.

Launch terminal and enter the command below (hit enter when prompted to progress the install):

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install ImageMagick

ImageMagick is a highly flexible image editing tool that we will use in this case to merge the images. This can be installed with one command:

Enter the following command:

brew install imagemagick

Using ImageMagick

Now to use the software to do the merge, navigate to folder holding all the images and use the following:

convert *.jpg output.pdf

The above will locate all the .jpg files in the directory and merge them into in the on file; output.pdf. Just make sure that all the files you are wanting to do this have a naming convention that can be ordered easily when rebuilt into the pdf file.

If you find that the output file size is really too large for your needs you can always compress it to a reasonable size. I use the following which gives good compression without actually reducing any visible quality:

convert -quality 60 *.jpg output.pdf

Leave a Reply

Your email address will not be published. Required fields are marked *

*