Page 1 of 1

Converting pdf to jpg (or flat pdf)

Posted: 2019-04-11T03:38:43-07:00
by Precision999
Hi

I've done a fait bit of googling and trying out different options, but I can't seem to achieve what I need.

I need to be able to take a pdf, convert to a 1200dpi jpg, and then produce a new pdf from there (effectively flattening the pdf). The quality needs to be high.

If convert.exe can do this in one go, great, but I'm happy if I can just get a good quality jpg and then worry about converting to pdf afterwards.

Can someone help me with the convert command line needed for this? - I've tried playing with -resize, -density, -flatten, -geometry, -resize etc etc and I get varying results, but not the nice high-res jpg I'm looking for, so I'm obviously not understanding them properly.

Thanks!

Re: Converting pdf to jpg (or flat pdf)

Posted: 2019-04-11T03:49:13-07:00
by snibgo
What version of IM, on what platform. I'll assume IM v7. If you use v6, use "convert" instead of "magick".

How about:

Code: Select all

magick -density 1200 in.pdf out.pdf
If you want just the first page:

Code: Select all

magick -density 1200 in.pdf[0] out.pdf

Re: Converting pdf to jpg (or flat pdf)

Posted: 2019-04-12T03:05:03-07:00
by Precision999
Thanks for your reply - I'm using IM7 by the way.

Your examples seem simple enough, but when I try it with either convert or magick, I get this:

Image

I'll try re-installing and see if that helps.

Re: Converting pdf to jpg (or flat pdf)

Posted: 2019-04-12T03:38:29-07:00
by snibgo
How are you running the program? I showed you commands that you can type at the command line. This means in a command window, aka command prompt, aka terminal, aka console, aka cmd.exe.

Check that these commands work:

Code: Select all

magick rose: r.png

magick r.png r.jpg

Re: Converting pdf to jpg (or flat pdf)

Posted: 2019-04-12T06:46:38-07:00
by Precision999
I'm running via command line.

I uninstalled and then re-installed. I installed 'Win64 dynamic at 16 bits-per-pixel component' this time, so maybe I got the wrong install file previously?

In any case, it works fine now - thanks!