I'm facing a big colorspace problem for quite a while now and couldn't get any good results, so I try finding some tips here.
What I want to achieve:
I've got an image (438x438px) to which I want to apply a circle mask (b/w - 438x438px). The mask has a black circle (RGB0,0,0 representing the transparent area), the edges around the circle are white (RGB255,255,255 background color). I use the following command line options to achieve the desired result:
Code: Select all
convert mask.jpg source.jpg -compose Screen -composite result.jpg
For RGB images everything works just fine, the mask is applied and the colors are preserved.
Now, the problem is with CMYK images (mask CMYK0,0,0,100% and source.jpg CMYK). If I just use the above listed command, I simply get the mask as result showing just the black circle.
If I add the option "-colorspace cmyk" I get the image masked with the circle as planned, but all colorinformation seems to be gone, the image is b/w.
Code: Select all
convert mask.jpg source.jpg -compose Screen -colorspace cmyk -composite result.jpg
If I try to use an icc profile instead of the colorspace option, the result gets even worse, the circle is nearly filled black, I can vaguely discern the outlines of source.jpg.
Code: Select all
convert mask.jpg source.jpg -compose Screen -profile ISOcoated(...).icc -composite result.jpg
If I then add the option "colorspace cmyk" again, the result gets a little bit better, but still the colors are not nearly the same as in the source.jpg. The image looks a little bit darker than the original and the colors are palish, showing a tendency towards black/white.
Code: Select all
convert mask.jpg source.jpg -compose Screen -profile ISOcoated(...).icc -colorspace cmyk -composite result.jpg
What can I do to get the desired result? With colorspace RGB everything works fine, with CMYK I can't find any way to achieve the masked image with original colors.
Besides: Doing the masking in RGB colorspace and converting then to CMYK would work but is not an option because the colors of the resulting image are not the same as in the original image.
Are there any other ways to apply a mask to an image which might work better with CMYK images? I read something about round thumbnails, there they are using -matte options and CopyOpacity and stuff like that, but I wasn't able to get any masked image using these commands.
Am I missing something in my way of doing it? Any option which will help to preserve the color informations?
I'm also trying to play around with an alpha channel added to one of the cmyk images. But I'm not really familiar with this matter. If I apply an alpha channel (circle shape) to the mask.jpg using photoshop 5.x I no longer can save it as jpg (nor as tif).
In addition my imagemagick version (6.1 IIRC) seems to not supporting the cmyka colorspace. If I just try to perform:
Code: Select all
convert mask.jpg source.jpg -compose Screen -colorspace cmyka -composite result.jpg
... imagemagick tells me that the colorspace cmyka is not supported.
I'm looking forward to receive any tip whatsoever. I'm really stuck here and playing around for days now.
I have to work with CMYK colorspace because I'm working on a print-job-project where the masked image is part of a PDF-creation. These pdfs are then printed out in some kind of book and the print office just needs CMYK images to prevent being forced to apply an icc profile as stated above (resulting in slight color changes).
Thanks in advance!
P.S. I will try to link some result images here tomorrow.