Page 1 of 1

Compose CMYK Files Using CompositeImageChannel function

Posted: 2011-01-19T03:37:06-07:00
by diuming
Dear Master,

I'm using CompositeImageChannel to compose CMYK files, But black channel always appear "black" no any image in in.
C,M,Y channels are look very well.
.
.
status = CompositeImageChannel(cmykImage, BlackChannel , CopyBlackCompositeOp , srcImage, 0, 0);
.
.
WriteImage(imageInfo, cmykImage);

somebody can help me to figure out , thanks!! :D

Re: Compose CMYK Files Using CompositeImageChannel function

Posted: 2011-01-19T16:24:53-07:00
by anthony
The problem is that it copies channels. A RGB Greyscale image does not contain Black.
As such you get nothing copied!

See...
http://www.imagemagick.org/Usage/bugs/testing/

Yes I do consider this a bug. One that has been present for a VERY VERY long time.

In my thinking, if the source image is not CMYK, and thus does NOT contain a black channel, that image should be treated as a greyscale source for the black channel data. This is basically what CopyOpacity does.

The way around this is to use -combine with four greyscale channel images to build the CMYK image.

Alternative you can use -channel K -combine to convert a single greyscale image to a CMYK image with only the back channel as valid, then use CopyBlack to merge it into the other image.

Re: Compose CMYK Files Using CompositeImageChannel function

Posted: 2011-01-20T01:36:23-07:00
by diuming
Dear Master,

Sorry! I just focus on C function, not command.

Your mean is use CombineImages() function. Right?

Thank for quickly reply.

Diuming

Re: Compose CMYK Files Using CompositeImageChannel function

Posted: 2011-01-20T05:43:44-07:00
by anthony
Correct. BUT just as in the Command ling API there is a trick to 'combining' RGB greyscale channel images into a non-RGB image.

You first need to 'set' (that is just set, don't actually change) the colorspace of the incoming images, so when CombineImages() creates a new image, it creates it in the correct color space. It is a little bit of a 'hack' but it works for generating the special 4 channel CMYK image.

The details were worked out for command line API, but the exact same equivalent method is used for any other API too.

Re: Compose CMYK Files Using CompositeImageChannel function

Posted: 2011-01-20T06:07:10-07:00
by diuming
I got it. :D
thank you so much!!

Diuming