Why does png -> pdf yield a lot of white space?

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
andrejas
Posts: 2
Joined: 2011-12-21T03:23:05-07:00
Authentication code: 8675308

Why does png -> pdf yield a lot of white space?

Post by andrejas »

Hi all,

I am trying to convert an A4 sized png to pdf using the command

Code: Select all

convert testa4.png testa4.pdf
Strangely though, the pdf gets a lot of white space added.

Here is the source png:

Image

Resulting pdf:

http://clear-topic.com/screenshots/a4/testa4.pdf

Can anyone explain me why and, more importantly, how I can get my pdf to be the exact size as the png?

Thanks in advance.

I have the same results on OSX Leopard with ImageMagick 6.7.1-1 2011-12-21 Q16 as on Fedora 8 using ImageMagick 6.3.5 10/13/08 Q16.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Why does png -> pdf yield a lot of white space?

Post by fmw42 »

Your image resolution does not match your page geometry. try

convert testa4.png +repage testa4.pdf

or

convert testa4.png +repage -density 72 testa4.pdf
andrejas
Posts: 2
Joined: 2011-12-21T03:23:05-07:00
Authentication code: 8675308

Re: Why does png -> pdf yield a lot of white space?

Post by andrejas »

Thanks a lot, that works like a charm!

I'll read some more about resolution and geometry to understand the basics.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Why does png -> pdf yield a lot of white space?

Post by fmw42 »

andrejas wrote:Thanks a lot, that works like a charm!

I'll read some more about resolution and geometry to understand the basics.
Take a look at

identify -verbose yourimage.png

The geometry is the virtual canvas. The resolution is the size of the image data.

see http://www.imagemagick.org/Usage/basics/#page
Post Reply