Page 1 of 1

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

Posted: 2011-12-21T06:00:59-07:00
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.

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

Posted: 2011-12-21T10:13:01-07:00
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

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

Posted: 2011-12-21T13:27:23-07:00
by andrejas
Thanks a lot, that works like a charm!

I'll read some more about resolution and geometry to understand the basics.

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

Posted: 2011-12-21T13:45:03-07:00
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