BeeJay
BeeJay

Reputation: 29

ImageMagick or Ghostscript: Create Image from PDF

I'm working on a big problem: I have to create a perfect colored JPEG from a PDF file. But there still small differences in green or blue color. I'm using Ghostscript version 8.71 on a Debian system.

Original PDF file:

The simple way via

convert output.pdf -density 600 -quality 100 output.jpg

Result:

creates a very light green having nothing to do with the color in the PDF.

After that I tried two other ways with better results, but not perfect:

Via ImageMagick:

convert output.pdf -profile sRGB_v4_ICC_preference.icc \
                   -density 600 -quality 100 test.jpg

convert -profile ISOcoated_v2_eci.icc -profile eciRGB_v2.icc \
        -quality 100 test-1.jpg finish-1.png

Result: Links like before with filename "finish-0.png" (I can just write two links).

Via Ghostscript:

gs -dNOPAUSE -sDEVICE=jpegcmyk -dFirstPage=1 -dLastPage=237 \
   -sOutputFile=image%d.jpg -dJPEGQ=95 -dUseCIEColor -g850x610 \
   -dPDFFitPage -r300 -q output.pdf -c quit

Result: Links like before with filename "image1.jpg" (I can just write two links).

Anybody has an idea to get a perfect result?

Upvotes: 2

Views: 2833

Answers (1)

KenS
KenS

Reputation: 31199

First, use a recent version of Ghostscript, 8.71 is 3 years old. Versions prior to 9.0 will use standard PostScript colour conversions, 9.0 onwards use Little CMS. Your PDF file uses ICC profile based colour spaces with 3 components (RGB), PostScritp RGB->CMYK is fast but inaccurate, so best not to do that.

I believe that if you use a decently up to date version you will find the results adequate without any further tweaking. Do NOT use -dUseCIEColor! That's a horrible PostScript kludge.

It also looks like the jpegcmyk device isn't doing proper colour management, is there a reason you can't use the jpeg device ?

Upvotes: 1

Related Questions