Problem converting a set of PNG files to 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
dwidmann
Posts: 2
Joined: 2014-04-21T23:39:21-07:00
Authentication code: 6789

Problem converting a set of PNG files to PDF

Post by dwidmann »

When I try to convert a set of PNG files (all of which are 1700x2200, 200x200 DPI, confirmed with identify) as follows:
convert *.png test.pdf
This gives me a very strange result - every page has a seemingly arbitrary amount of white space added to it, such that none of the pages are the expected size (8.5x11), and in fact every single page is a different size. Why is this and what can I do about it?

A sample of what it gives me here.

Version: ImageMagick 6.8.9-0 Q16 x86_64 2014-04-13
(and for good measure) GPL Ghostscript 9.14 (2014-03-26)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Problem converting a set of PNG files to PDF

Post by snibgo »

dwidmann wrote:... a seemingly arbitrary amount ...
Not arbitrary. When we identify ...

Code: Select all

F:\web\im>%IM%identify mass-spectrometer-problem_*.png

mass-spectrometer-problem_01.png PNG 1700x2200 1770x3058+0+0 8-bit sRGB 9c 168KB 0.000u 0:00.000
mass-spectrometer-problem_02.png[1] PNG 1700x2200 1930x3061+117+0 8-bit sRGB 8c 60.1KB 0.000u 0:00.000
... we see 2 images, of the same size, but each placed on a different canvas. "+repage" will cure that:

Code: Select all

convert mass-spectrometer-problem_*.png +repage x.pdf
snibgo's IM pages: im.snibgo.com
dwidmann
Posts: 2
Joined: 2014-04-21T23:39:21-07:00
Authentication code: 6789

Re: Problem converting a set of PNG files to PDF

Post by dwidmann »

Ah, thanks for the assist snibgo!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Problem converting a set of PNG files to PDF

Post by snibgo »

My pleasure. Thanks for providing all the information needed to solve the problem:

- a description of what is wrong;
- the command that did it;
- input files and output file;
- version numbers of software (so I quickly ruled out using last-century software).

You'd be surprised how long it can take to drag this out of people.
snibgo's IM pages: im.snibgo.com
Post Reply