Combine Multiple Images Into One PDF
use command-line tool to create a single PDF file from multiple screenshots
We nowadays take many screenshots. Sharing those images is a hassle. It would be easier to merge the images into a single PDF file. This can be done for free with a command-line tool ImageMagick on masOS, following this original guide from Stack Overflow1.
Take screenshots
On macOS, there are a few ways to take a screenshot:
Command + Shift + 3 will take a snapshot in PNG format for the entire screen.
Command + Shift + 4 will turn the cursor into an “aim” sign that allows you to take a selected area of the window, rather than the entire screen.
These screenshot images are saved in the ~/Desktop folder.
Install ImageMagick
ImageMagick is a powerful image-processing tool for command-line use.
Install ImageMagick with macOS’s popular package manager brew.
$ brew install imagemagick
Create PDF
First, rename the images with serialized standard names:
Then move them into a separate folder. Enter that folder. Convert them into a single PDF file. Use * sign as a wild card to select all the images.
$ convert demo*.png demo.pdf
There you go. Hello, demo.pdf!
Now you can share this demo.pdf with your other devices or another friend. It’s much easier to deal with than a bunch of image files.