PDF to PNG weirdness

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
BubbaDoom

PDF to PNG weirdness

Post by BubbaDoom »

I'm using ImageMagick 6.5.4-2 2010-07-07 on CentOS 5.5 x64
to convert a pdf file to a png.

I run this command on my pdf:
convert -density 300x300 -resize 800x500 3100.348481.569075_back.pdf 3100.348481.569075_back.png

This is the original pdf:
http://images.greetingcarduniverse.com/ ... 5_back.pdf

This is the resulting png:
http://images.greetingcarduniverse.com/ ... 5_back.png

Why is the image of the pdf on the png so tiny?
It does the same thing for gif or jpg also.
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: PDF to PNG weirdness

Post by Drarakel »

The PDF has a larger "MediaBox", with your picture in the lower left corner. A lot of PDF viewers will only display the "CropBox" (which is relatively small in your case). With ImageMagick/Ghostscript, you can use the option "-define pdf:use-cropbox=true" to get just this area:
convert -density 300 -define pdf:use-cropbox=true 3100.348481.569075_back.pdf 3100.348481.569075_back.png
See also here: http://www.imagemagick.org/Usage/formats/#pdf_reading
BubbaDoom

Re: PDF to PNG weirdness

Post by BubbaDoom »

Thanks for that tip, you learn something new every day.

Works great now!
Post Reply