Page 1 of 1

[SOLVED] Magick++ ColorCMYK

Posted: 2018-12-13T01:47:54-07:00
by rodlie
Hi,

Would it be possible to get support for ColorCMYK in Magick++? I need to draw CMYK colors on CMYK image and can't find any CMYK color support in Magick++.

Regards

Re: Magick++ ColorCMYK

Posted: 2018-12-13T04:47:16-07:00
by rodlie
So, I'm able to get the correct(-ish) color by just adding cyan=>red etc, but for some reason the color/brush is transparent.

Image

Edit:
I'm running 6.9.10-16 Q16HDRI.

Re: Magick++ ColorCMYK

Posted: 2018-12-13T09:42:03-07:00
by fmw42
What color brush? ImageMagick is command line driven for the most part.

Re: Magick++ ColorCMYK

Posted: 2018-12-13T11:21:45-07:00
by rodlie
I setup a brush then draw (DrawLine with strokeColor etc). Works fine on RGB, but not CMYK. (as seen on the image above). I guess ColorCMYK support in Magick++ would fix this? Or are there any workaround for this?

Code: Select all

image.strokeAntiAlias(...);
image.strokeLineCap(...);
image.strokeLineJoin(...);
image.strokeWidth(...);
image.strokeColor(...);
image.draw(...);

Re: Magick++ ColorCMYK

Posted: 2018-12-13T13:54:53-07:00
by fmw42
ImageMagick works best in RGB colors. I am not sure you can draw properly in CMYK. But I will defer to the IM developers to correct me.

Re: Magick++ ColorCMYK

Posted: 2018-12-13T14:19:53-07:00
by snibgo
IM colour names are just shortcuts to particular pixel numbers, eg "red" is "#f00". But in CMY, "#f00" is really cyan.

So I suggest you use numbers, not names, when using CMYK.

Re: Magick++ ColorCMYK

Posted: 2018-12-14T07:55:24-07:00
by rodlie
I always use color numbers in IM (so I don't need to reference colors.xml).

My problem is that it seems IM always will draw in RGB, but on an CMYK image the colors are "inverted" and transparent. I can fix the color but not the transparency.

Re: Magick++ ColorCMYK

Posted: 2018-12-14T10:43:23-07:00
by fmw42
rodlie wrote: 2018-12-14T07:55:24-07:00 My problem is that it seems IM always will draw in RGB, but on an CMYK image the colors are "inverted" and transparent. I can fix the color but not the transparency.
That is what I mentioned earlier. I believe that -draw only works in RGB.

CMYK color specifications I believe are just converted to RGB values before being used.

Re: Magick++ ColorCMYK

Posted: 2018-12-14T11:19:11-07:00
by rodlie
Yeah, that's what I though. But using RGB colors still produces the transparency effect when drawing on CMYK, is there a way to workaround that issue? I would prefer not to convert the image to RGB before drawing and then converting back to CMYK, that will just kill performance (I could of course find ways around that as-well, but I just want to draw some pixels on an image just before print).

Re: Magick++ ColorCMYK

Posted: 2018-12-14T13:54:00-07:00
by fmw42
You should convert your CMYK image to RGB, then draw on it, then convert back to CMYK if you need it in that colorspace. Conversion with profiles does a better job than just -colorspace.

Re: Magick++ ColorCMYK

Posted: 2018-12-14T14:20:37-07:00
by rodlie
Yeah, I know, but as I said earlier I don't want to do that if possible. Why is drawing anything on CMYK (except for black) transparent? is there something I need to set, or know about? I'm also open to modifying the (IM) source just to get this (no transparency) working. Any pointers to the problem is welcome :)

Re: Magick++ ColorCMYK

Posted: 2018-12-14T14:40:06-07:00
by rodlie
Found the issue. I'm compositing the drawn image as an "layer" on top of an transparent image (CMYKA) and the composite (Over) seems to add the transparency (on the brush strokes).

Re: Magick++ ColorCMYK

Posted: 2018-12-15T18:32:41-07:00
by rodlie
I was a bit quick on that one. I still get transparent color/stroke when I draw on the image and do nothing else. So draw (rgb) on CMYK image will produce transparent color/stroke on any color.

Re: [SOLVED] Magick++ ColorCMYK

Posted: 2018-12-25T23:02:09-07:00
by rodlie
I have finally ported the app to IM7 and to my surprise it now works, no more transparent strokes :)