Low resolution when converting small PDF to png

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
dala
Posts: 2
Joined: 2012-12-11T02:58:55-07:00
Authentication code: 6789

Low resolution when converting small PDF to png

Post by dala »

I have a small PDF file which is defined as being 47 points wide by 48 points high.
When I use imagemagic to convert this file to a png I am not able to get the resolution any higher than 47px x 48px.
In other words, if I make a png which is 200 px high, the resolution is very bad.
I have tried using the -density option, but it doesen't help.

The pdf is a vectorfile, its not just an image put into a pdf, so I can scale it as much as I like, but I don't know how to do this using imagemagic.
It seems like imagemagic by default will max 1 pixel per point. How can I fix this?

In other words, how can I make a tiny vectorfile come out as a large high resolution image?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Low resolution when converting small PDF to png

Post by fmw42 »

I am not sure about conversions between points and pixels. However, to get better quality the -density must be put before the pdf and you can use supersampling to increase the quality.

convert -density 288 image.pdf -resize 25% image.png

default density is 72, so 72*4=288 and then resize by 1/4=25%

You can increase the density as much as you want and change the resize to the output pixel size as desired.

If I misunderstand your issue, then please explain in more detail and perhaps provide links to example input and output. Also provide your command line and version of IM and platform.
dala
Posts: 2
Joined: 2012-12-11T02:58:55-07:00
Authentication code: 6789

Re: Low resolution when converting small PDF to png

Post by dala »

>However, to get better quality the -density must be put before the pdf...

Thanks, that worked!
I had allready tried the -density parameter but I had put it AFTER the input file;I didn't know that it would make a difference.
Putting it IN FRONT of the input file did the trick!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Low resolution when converting small PDF to png

Post by fmw42 »

dala wrote:>However, to get better quality the -density must be put before the pdf...

Thanks, that worked!
I had allready tried the -density parameter but I had put it AFTER the input file;I didn't know that it would make a difference.
Putting it IN FRONT of the input file did the trick!

A number of settings, like density, need to be put before reading vector files because they have no intrinsic size. Otherwise for raster files, they should following the input.
Post Reply