Page 1 of 1
PDF to PNG > Problems with DPI
Posted: 2016-07-01T02:27:06-07:00
by anbr
Hi everybody!
I try to convert several PDFs (which consist of vector graphics ) to PNG-Files with the following code on command-line:
Code: Select all
mogrify -density 300 -format png *.pdf
The size of the arising PNGs is correct, but unfortunaltely the resolution ist not (96 dpi instead of 300). I tried to add the command
-resample 300 at different positions in the code as I read that the order matters, but I couldn't figure it out. Could you please give me some advice?
Re: PDF to PNG > Problems with DPI
Posted: 2016-07-01T05:50:51-07:00
by GeeMack
anbr wrote:Could you please give me some advice?
Can you fill us in on which version of IM you're using and what OS you're working on?
Re: PDF to PNG > Problems with DPI
Posted: 2016-07-01T06:01:48-07:00
by anbr
Sorry, didn't think of that..
I'm running Fedora 18 and using ImageMagick 6.7.7-5. Actually I never cared about that before and was just happy that ImageMagick was already installed on this OS.
Re: PDF to PNG > Problems with DPI
Posted: 2016-07-01T08:38:58-07:00
by GeeMack
anbr wrote:... just happy that ImageMagick was already installed on this OS.
Yep, IM is always good. Your 6.7.x... version is pretty old, so I don't know if it will help (or if it will even work), but you might try adding "-units PixelsPerInch" to your command ahead of the "-density 300" setting.
Re: PDF to PNG > Problems with DPI
Posted: 2016-07-01T09:51:42-07:00
by snibgo
As you are reading PDFs, another variable is the version of Ghostscript. Eg, I use 9.15 which is fairly recent.
Re: PDF to PNG > Problems with DPI
Posted: 2016-07-05T01:30:02-07:00
by anbr
Thanks! Adding
-units PixelsPerInch worked, even with my outdated version. So the PNG is the same pixel size as before but now the resolution is set to the specified value. Respectively, nearly the specified value (some applications shows 299 instead of 300) which I guess is due to the somewhere internal usage of pixels per centimeter.
Thank you for your efforts!