Converting Multiple Images into a single page pdf

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Nya060
Posts: 1
Joined: 2020-02-05T11:59:14-07:00
Authentication code: 1152

Converting Multiple Images into a single page pdf

Post by Nya060 »

Hello, I was trying to convert a bunch of images into a single pdf. Which I was able to do without any problems using

Code: Select all

convert "*.png" -quality 100 output.pdf
Now my question, is there any way to achieve the same results as above command would give but I would like to have all images on a single page
Now many users suggested me that I can use convert with -append or montage them and then convert to pdf
But the problem is that most of the images i am trying to convert are of different resolutions and when I try to convert them to single page The quality gets destroyed
Also there is the problem of the white spaces which occur when one of the image is greater in width
So the remaining images which align to the left by default leave a white space in the remaining side of the page
How can I get rid of those?

TLDR; I want to convert multiple images of different size onto a single page of a pdf aligned in center and page having transparent background

I just started using Imagemagick, I did read the documentations but I am still kinda lost. Help Appreciated.

User avatar
fmw42
Posts: 26269
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Converting Multiple Images into a single page pdf

Post by fmw42 »

What size page? You will have to combine all your images by appending or compositing on a transparent background. Then resize that to fit the default page size converted to pixels. For various page sizes, see https://imagemagick.org/script/command- ... s.php#page. So for example, for a letter size page, it has dimensions of 612x792 pixels as WxH. If you simply want to append them vertically on a transparent background, then try

Code: Select all

convert *.png -background transparent -gravity center -append -resize 612x792 output.pdf
Note that -quality has no effect for pdf output. If you want higher quality, you do that when reading or printing the pdf by setting -density to some value larger than the default 72.

Post Reply