PDF to JPG is of bad quality

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
brettalton

PDF to JPG is of bad quality

Post by brettalton »

I have to convert 64 PDF files to JPG for work.

I received help previously with my CMYK/RGB colourspace problem, but now I have another problem: quality.

Previously this type of conversion was done by some sort of proprietary Windows program, but now I'm assigned to the task and want to use my Linux PC with ImageMagick.

The current command I use is:

Code: Select all

for file in `ls *.pdf`; do
	convert -colorspace RGB $file -resize 800 `echo $file | sed 's/\.pdf$/\.jpg/'`
done
adding a couple more options, such as:

Code: Select all

for file in `ls *.pdf`; do
	convert -colorspace RGB $file -resize 800 -interlace none -density 300 `echo $file | sed 's/\.pdf$/\.jpg/'`
done
makes no change in the image or file size.

The text seems to be very blurry on some of the PDFs compared to whatever this proprietary Windows program they used outputed.

I'm using Ubuntu 8.04.1, ImageMagick '6.3.7 02/19/08 Q16' and Ghostscript '8.61 (2007-11-21)'.

PDF I need to convert: http://staging.altonlabs.com/imagemagick/new.pdf [5.4 MB]
Image converted with ImageMagick: http://staging.altonlabs.com/imagemagick/new.jpg [265 kB]
Old image converted with Windows proprietary software: http://staging.altonlabs.com/imagemagick/old.jpg [290 kB]

Is there an option I'm missing?
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: PDF to JPG is of bad quality

Post by Bonzo »

Try a density after convert:

Code: Select all

convert -density 400 -colorspace RGB $file -resize 800 `echo $file | sed 's/\.pdf$/\.jpg/'`
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: PDF to JPG is of bad quality

Post by fmw42 »

brettalton wrote:I have to convert 64 PDF files to JPG for work.

I received help previously with my CMYK/RGB colourspace problem, but now I have another problem: quality.

Previously this type of conversion was done by some sort of proprietary Windows program, but now I'm assigned to the task and want to use my Linux PC with ImageMagick.

The current command I use is:

Code: Select all

for file in `ls *.pdf`; do
	convert -colorspace RGB $file -resize 800 `echo $file | sed 's/\.pdf$/\.jpg/'`
done
adding a couple more options, such as:

Code: Select all

for file in `ls *.pdf`; do
	convert -colorspace RGB $file -resize 800 -interlace none -density 300 `echo $file | sed 's/\.pdf$/\.jpg/'`
done
makes no change in the image or file size.

The text seems to be very blurry on some of the PDFs compared to whatever this proprietary Windows program they used outputed.

I'm using Ubuntu 8.04.1, ImageMagick '6.3.7 02/19/08 Q16' and Ghostscript '8.61 (2007-11-21)'.

PDF I need to convert: http://staging.altonlabs.com/imagemagick/new.pdf [5.4 MB]
Image converted with ImageMagick: http://staging.altonlabs.com/imagemagick/new.jpg [265 kB]
Old image converted with Windows proprietary software: http://staging.altonlabs.com/imagemagick/old.jpg [290 kB]

Is there an option I'm missing?
Neither interlace nor density will change the filesize. Density only changes the size that it will be printed. If you want something else similar see -resample http://www.imagemagick.org/script/comma ... p#resample or -quality http://www.imagemagick.org/script/comma ... hp#quality as both will change the filesize either by changing the number of pixels or by compression
brettalton

Re: PDF to JPG is of bad quality

Post by brettalton »

Amazing, it was the 'quality' flag.

Here is what now works for me:

Code: Select all

for file in `ls *.pdf`; do
       convert -verbose -colorspace RGB -resize 800 -interlace none -density 300 -quality 80 $file `echo $file | sed 's/\.pdf$/\.jpg/'`
done
That will convert all PDFs to JPGs in the current folder.

Thank you, the both of you!
Post Reply