problem with cmyk profiles

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
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

problem with cmyk profiles

Post by fmw42 »

I have very little experience with profiles. So perhaps the solution is obvious to others and I would appreciate any help.

I have a cmyk PSD file (with background transparency) that probably has cmyk profiles in it. IM identify -verbose shows (one layer/frame) with several profiles (but I am not sure which one(s) are relevant to this issue.

Profiles:
Profile-8bim: 16122 bytes
Profile-exif: 302 bytes
Profile-iptc: 7 bytes
unknown[2,0]:
Profile-xmp: 6453 bytes


When processing with IM, I believe that IM copies the profiles from the first image in the sequence to the output. This causes some problems when trying to overlay the transparent PSD file onto a checkerboard pattern. So far, I have not been able to solve this within IM alone. For example:

Here is the original PSD file:
http://www.fmwconcepts.com/misc_tests/p ... nsback.psd

If I do this:

width=300
height=300
convert \( -size ${width}x${height} tile:ps_checks.gif \) test4_cmyk_transback.psd[0] \
-background white -flatten test4_cmyk_transback_tile1.jpg

Image

The colors in the two images are incorrect, probably because the profiles are lost, but the checkerboard is correct.

However, if I do this:

convert test4_cmyk_transback.psd[0] -tile ps_checks.gif -draw "color 0,0 reset" \
test4_cmyk_transback.psd[0] -flatten test4_cmyk_transback_tile2.jpg

Image

Then the two images have correct coloration, but the checkerboard is wrong, probably because it was grayscale and inherited the cmyk profiles from the psd file.

Anyone know how I can get the correct combination of preserving the coloration (profiles) of the two images and keep the checkerboard correct also? Perhaps preparing a different checkerboard image for cmyk use?

Any solution within IM only?

Any solution with some other external program to copy the profiles from the input to the output after IM has processed it?

Thanks

Fred
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: problem with cmyk profiles

Post by fmw42 »

I think I finally figured this out. The following seems to work.


convert -respect-parenthesis \
\( test4_cmyk_transback.psd[0] -profile Profiles/CMYK.icc -profile Profiles/sRGB.icc \) \
-tile ps_checks.gif -draw "color 0,0 reset" \
\( test4_cmyk_transback.psd[0] -profile Profiles/CMYK.icc -profile Profiles/sRGB.icc \) \
-flatten test4_cmyk_transback_tile3.jpg

Image

And so does this:


convert \
test4_cmyk_transback.psd[0] -profile Profiles/CMYK.icc -profile Profiles/sRGB.icc \
-tile ps_checks.gif -draw "color 0,0 reset" \
test4_cmyk_transback.psd[0] -profile Profiles/CMYK.icc -profile Profiles/sRGB.icc \
-flatten test4_cmyk_transback_tile3.jpg


And so does this:

width=300
height=300
convert \( -size ${width}x${height} tile:ps_checks.gif \) \
\( test4_cmyk_transback.psd[0] -profile Profiles/CMYK.icc -profile Profiles/sRGB.icc \) \
-background white -flatten test4_cmyk_transback_tile4.jpg


Since I had to add both profiles, then perhaps I was wrong and there were no profiles in the original image.
Drarakel
Posts: 547
Joined: 2010-04-07T12:36:59-07:00
Authentication code: 8675308

Re: problem with cmyk profiles

Post by Drarakel »

Yes, there is no color profile in your PSD (at least nothing that IM could use). So, your method of converting the PSD to RGB was correct. Of course, you can produce a CMYK output, too (by converting the whole ps_checks.gif to CMYK first). Just make sure that all the images in your sequence have the same colorspace. :wink:

You could use exiftool to re-insert the metadata if you're losing some of it in the IM conversion. But in this example, the metadata is problably not important.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: problem with cmyk profiles

Post by fmw42 »

Of course, you can produce a CMYK output, too (by converting the whole ps_checks.gif to CMYK first)
I tried that but it did not seem to work. Perhaps I made some mistake.

I tried both

convert ps_checks.gif -colorspace CMYK ps_checks_cmyk.jpg

and

convert ps_checks.gif -profile Profiles/CMYK.icc ps_checks_cmyk.jpg

But they did not work.

However, I just now tried:

convert ps_checks.gif -profile Profiles/sRGB.icc -profile Profiles/CMYK.icc ps_checks_cmyk.jpg

and that worked.

Still learning about profiles.

Thanks.
amar_nishant

Re: problem with cmyk profiles

Post by amar_nishant »

I had the same problem but i ended up using psd.

Try
convert image.tif -profile profile/USWebCoatedSWOP.icc -strip imageCMYKwithTransparency.psd

you can also try it with tiff. I dont know if it will work.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: problem with cmyk profiles

Post by fmw42 »

My client needs to have jpg files that simulate how the real PSD and TIFF files look in Photoshop.
Post Reply