Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Is it possible to turn off or lower the compression of images inside a PDF with Ghostscript when I convert to jpg?

I currently use the following:

gs \
 -dNOPAUSE \
 -q \
 -dBATCH \
 -dSAFER \
 -sDEVICE=jpeg \
 -dUseCIEColor \
 -dJPEGQ=95 \
 -r150 \
 -dTextAlphaBits=4 \
 -dGraphicsAlphaBits=4 \
 -dMaxStripSize=8192 \
 -sOutputFile=/test_dir/test-%d.jpg \
  "/test-dir/test.pdf"
share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

This commandline parameter

-dJPEGQ=95

deteriorates the JPEG Quality already! To keep the original JPEG quality of images embedded in the original PDF, and to minimize quality deterioration for other parts of your PDF page objects, use

-dJPEGQ=100

Keep in mind that JPEG is a lossy image format anyway. If your PDF pages did come with text sections, you will always lose quality, because JPEG isn't a good format to convert to if you have many small areas with sharply contrasting filled areas (such as black characters on white background are). (PNG is a better format for this.)

The next parameter you can employ to increase your output quality is for resolution:

-r150

Try this instead:

-r300

or even

-r600

(File sizes will roughly quadruple each time... but that's the price of increased quality.)

You may be better off by converting to TIFF or PNG... unless your need is for JPEG explicitly for some other reason.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.