Converting pdf to high quality 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
Igor
Posts: 2
Joined: 2013-06-01T02:41:46-07:00
Authentication code: 6789

Converting pdf to high quality png

Post by Igor »

Hello there!
I must say that I'm a complete newbie to imagemagick and it may be the reason why I'm struggling to figure out how to convert my high quality pdf file to png file preferably of the same quality as the source file (by the way I tried reading the manual but there're some things that I still don't clearly understand)
I guess it's not possible since pdf files use a combination of vector and raster images while it's not the case with png files. But I'd like to make the quality of my png file as good as possible and I would very appreciate any help that you can provide on how to do this using this truly wonderful program ,imagemagick. :D

P.S. Yeah I tried something like this:

Code: Select all

convert -resize 842x596 Pr_mt.pdf Pr_mt.png
But it yields a file with quite low quality .
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Converting pdf to high quality png

Post by snibgo »

For this, you almost certainly need "-density".

Vector images in PDF have no perfect setting for density. In general, higher numbers give higher quality.

Raster images in PDF work best when "-density" is an integer multiple (or fraction) of the original. For example, if the original is 300 dpi (dots per inch), density should be 300, 600 or 150.

Ideally, we would have a program that could read a PDF file, examine all the images, tell us the density of each, and recommend a reasonable density setting. Sadly, I don't know of such a program.

For PDF files that contain scanned pages, I use Adobe Reader to find the resolution. For modern scanners, this always seems to be a multiple of 150 dpi.
snibgo's IM pages: im.snibgo.com
Igor
Posts: 2
Joined: 2013-06-01T02:41:46-07:00
Authentication code: 6789

Re: Converting pdf to high quality png

Post by Igor »

Hello Snibgo.
Hmm seems so...I've just play around a bit with -density and seems like I've found what had been looking for. Thank you. Though there's also such thing as -quality , need to know what it does, I guess I need to do more browsing to figure this out hehe
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Converting pdf to high quality png

Post by snibgo »

"-quality" refers to the data loss when saving files, especially in JPG format. It is just a number that happens to be between 0 and 100, not a percentage.

Good places to start learning about IM:
http://www.imagemagick.org/script/comma ... ptions.php
http://www.imagemagick.org/script/comma ... essing.php
http://www.imagemagick.org/Usage/

IM is a great system, but complex. Feel free to ask.
snibgo's IM pages: im.snibgo.com
Post Reply