When I run

convert example.pdf example.png

I get a png image, but the image in the pdf is off-center and too small. How do I convert so that the png image is the right size and takes the whole page?

Actually, this conversion is an automatic feature of an Elog that I use. If I do end up altering the call to convert, I need to do it programatically so the image orientation is detected and the correct options applied.

When doing this with portrait-oriented images, it works fine.

example.pdf: https://www.dropbox.com/s/d8k2odc384tixzb/example.pdf

example.png: ExamplePNG

  • Sorry, I can't post the images directly, until I have 10 rep, I guess.
    – reasgt
    Jun 28, 2013 at 18:59

1 Answer 1


I think you are looking for the -trim option:

     -trim                trim image edges

You can use it like this:

convert -trim -background black example.pdf example.png

To get this image:

enter image description here

The image above takes up the whole page, save it and open it locally to see it correctly.

  • 1
    Also the -density option for resolution. Might also require repage after trimming. Jun 28, 2013 at 20:09
  • Yep, that works. Any idea why imagemagick does the conversion so poorly by default?
    – reasgt
    Jun 30, 2013 at 22:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .