pdf to jpg resolution problem

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
mij

pdf to jpg resolution problem

Post by mij »

I'm trying to convert each page of a pdf file to a low resolution jpg and a high resolution one. I'm using

Code: Select all

convert -scale 2000x1000 file.pdf hi-res%d.jpg
convert -scale 1000x500 file.pdf lo-res%d.jpg
It does creates a 1000x500 and 2000x1000 jpg for each page of the pdf, but both images are identical in definition. I mean, the hi-res image is just a pixelated scaled-up version of the lo-res one, even the text, wich should not be afected by resolution as far as I know.
Is there just a limit in the resolution that can be achieved converting a pdf into jpg??
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: pdf to jpg resolution problem

Post by Bonzo »

Look back through the previous posts there are quite a few questions about this. From memory you need to add a -density before reading in the image?
http://www.imagemagick.org/script/comma ... p?#density

Also -resize may be better than -scale; you can then try different filters.
http://www.imagemagick.org/script/comma ... hp?#resize

Note: Read the image in first.

Would something like this work ?

Code: Select all

convert -density 400 file.pdf -scale 2000x1000 hi-res%d.jpg
mij

Re: pdf to jpg resolution problem

Post by mij »

It just worked perfetcly. Thanks
CptWacko

Re: pdf to jpg resolution problem

Post by CptWacko »

Hi everyone,

When trying to convert a pdf to jpgs with "convert -density 400 energia.pdf -scale 2000x1000 hi-res%d.jpg", I encounter the following errors:
Magick: Postscript delegate failed `energia.pdf': No such file or directory @ er
ror/pdf.c/ReadPDFImage/645.
Magick: missing an image filename `hi-res%d.jpg' @ error/convert.c/ConvertImageCom
mand/2949.
The trouble is my pdf do exist and is right beside convert.exe and well hi-res%d.jpg is missing since its supposed to create those... I guess. I don't know what I'm understanding wrong here because it seems really easy.

Thanks to anyone that can help me !
CptWacko

Re: pdf to jpg resolution problem

Post by CptWacko »

Sorry, stupid me, it's all because I didn't had Ghostscript installed properly.
MIzunoX
Posts: 1
Joined: 2014-09-05T04:00:37-07:00
Authentication code: 6789

Re: pdf to jpg resolution problem

Post by MIzunoX »

it wont work for me either... i am resorting to using to using http://pdfjpg.net/ which allow for resolution scaling but id like to set the parameters myself ..
does anyone have a link to an easy tutorial how to do this?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: pdf to jpg resolution problem

Post by snibgo »

The most important control is "-density N" which must come before the input filename, because it is an option to the delegate that rasterises the PDF.
snibgo's IM pages: im.snibgo.com
Post Reply