How To Convert Multiple Images Into One Single PDF File

in #technology7 years ago

A lot of manga series found online are in image format, like JPG or PNG and it's one image for one page. Mac's Preview app can read them if needed, but that's not very convenient. It would be nice to merge them into one single PDF file so that it can be read in any device and easily shared with others. This can be accomplished with a command-line tool ImageMagick on Mac. Here's the step-by-step guide on how to do that.

Step 1: Take Screenshot

On Mac, there are a few ways to take a screenshot:

Command + Shift + 3 will take a snapshot in PNG for the entire window displayed on the mac, saving the image to ~/Desktop.

Command + Shift + 4 will turn the cursor into an "aim" sign. Pressing Space Bar will highlight the entire area under the current browser window and the "aim" sign will turn into a "camera" sign. Pressing the camera sign will take the snapshot of the highlighted area within the browser window, saving the image to ~/Desktop.

Step 2: Install ImageMagick

ImageMagick is a powerful image processing tool for command-line. There are a few versions available from Nix Package Manager, but it can be easily found in other package managers as well.

nix-env -i imagemagick-6.9.7-6

Step 3: Combine Multiple Images Into One Single PDF File

First rename the screenshot images into something with an easily identifiable standard name, like this:

-rw-r--r--@  1 zire  staff    3090 Jun  2 11:30 demo_1.png
-rw-r--r--@  1 zire  staff  426672 Jun  2 11:30 demo_2.png
-rw-r--r--@  1 zire  staff  798611 Jun  2 11:30 demo_3.png


Then move them into a separate folder and cd into this folder.

Run this simple command in the folder:

convert demo*.png demo.pdf


Hello there, demo.pdf.

-rw-r--r--   1 zire  staff  986119 Jun  2 11:33 demo.pdf
-rw-r--r--@  1 zire  staff    3090 Jun  2 11:30 demo_1.png
-rw-r--r--@  1 zire  staff  426672 Jun  2 11:30 demo_2.png
-rw-r--r--@  1 zire  staff  798611 Jun  2 11:30 demo_3.png


That's it. Voila!

Sort:  

Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:
https://guizishanren.com/convert-multiple-images-into-one-single-pdf/

yeah that's my blog ... good find robot