cmyk-jpg to pdf

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
markusbraun

cmyk-jpg to pdf

Post by markusbraun »

Hello!
I would ike to convert a cmyk-jpg to pdf. This is my command:
convert pic.jpg -units PixelsPerInch -density 254x254 pic.pdf

These are samples of input jpg and output pdf:
Imageinput
Imageoutput

The pdf image looks quite weird, as it has lost a lot of colors, or something like that.

I have almost no experience in all this image stuff, and I'm quite new to imageMagick... could someone please point me to what I'm doing wrong?
Thank you very much!

Markus Braun


These are the actual images:
input jpg
output pdf
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: cmyk-jpg to pdf

Post by Drarakel »

The problem could be that you have an input file with a color profile ("ISO Coated v2 300% (ECI)"). The PDF still has the JPG with this color profile, but a PDF viewer won't access the profile this way. And ImageMagick creates the PDF 'only' with a general /DeviceCMYK colorspace. So, your original color profile is not used when the PDF has to be displayed in another colorspace (usually, "US Web Coated SWOP v2" is used as a general source color profile for CMYK data).

Some possibilities:

- You can access the correct CMYK data with Ghostscript. Example:

Code: Select all

gs -dSAFER -dBATCH -dNOPAUSE -dNOPROMPT -dMaxBitmap=500000000 -dAlignToPixels=0 -dGridFitTT=2 -sDEVICE=tiff32nc -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -r254 -sOUTPUTFILE=pic1.tif pic.pdf
convert pic1.tif -profile "ISO Coated v2 300% (ECI).icc" -compress zip pic2.tif
The second IM command is just for assigning the correct color profile again.

- The PDF should display correctly in a program that allows you to set a CMYK working space - with your original color profile (probably with Acrobat).

- Or you could convert your CMYK image to "US Web Coated SWOP v2" first (if you have the profile). Example:

Code: Select all

convert pic.jpg -set units PixelsPerInch -set density 254 -profile USWebCoatedSWOP.icc +profile "icc,icm" -compress zip pic2.pdf
Not an ideal solution, but the PDF from ImageMagick should look ok (in every PDF viewer) after that.

For an even better solution, the PDF would have to be created with an /ICCBased object (where the color profile from the input image can be specified). I don't think that ImageMagick is able to do that.
markusbraun

Re: cmyk-jpg to pdf

Post by markusbraun »

Thank you for your help!
I'll need some time to try this, and some more to understand it... :-)
I'll post again later.


EDIT:
Thank you very much again, but I had to realize that all this profiles and colorspaces stuff is way to far ahead for me. I will have to go another way.

Thanks again,
Markus
Post Reply