Page 1 of 1

PDF to JPG is of bad quality

Posted: 2008-10-10T13:08:05-07:00
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?

Re: PDF to JPG is of bad quality

Posted: 2008-10-10T13:12:33-07:00
by Bonzo
Try a density after convert:

Code: Select all

convert -density 400 -colorspace RGB $file -resize 800 `echo $file | sed 's/\.pdf$/\.jpg/'`

Re: PDF to JPG is of bad quality

Posted: 2008-10-10T19:04:01-07:00
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

Re: PDF to JPG is of bad quality

Posted: 2008-10-11T09:15:30-07:00
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!