Page 1 of 1

How to convert single color (not image) CMYK with ICC profile to rgb.

Posted: 2020-02-07T03:20:49-07:00
by Mic
Hi !

Is there a way to convert single color CMYK with proflie to RGB . Something like :
var cmykColor = ColorCMYK(0,100,100,0);
var profileSRC = "CMYK\CoatedFOGRA39";
var profileDest = "AdobeRGB";

var colorRGB = Convert(cmykColor , profileSRC ,profileDest ).

?

Re: How to convert single color (not image) CMYK with ICC profile to rgb.

Posted: 2020-02-07T08:50:53-07:00
by snibgo
As far as I know, the only way to do this is by creating an image, eg 1x1 pixel, and converting that.

Re: How to convert single color (not image) CMYK with ICC profile to rgb.

Posted: 2020-02-09T09:52:27-07:00
by Mic
Thanks for replay, but I need something faster.

Re: How to convert single color (not image) CMYK with ICC profile to rgb.

Posted: 2020-02-09T23:37:03-07:00
by snibgo
Perhaps an LCMS function can do that.

Re: How to convert single color (not image) CMYK with ICC profile to rgb.

Posted: 2020-03-09T05:25:53-07:00
by SLS8
The Colourful .net library does exactly that.
But the suggested single pixel image is a fast way and you can add a Parallel.For loop too. The color result can be obtained by reading the pixel or with img.Histogram().First().Key;

test this code with a known online converter, I may be wrong about magicknet way of doing it

Code: Select all

	 MagickColor color1;
         using (MagickImage pix = new MagickImage(MagickColors.Red, 1, 1))
         {
            pix.RemoveProfile("sRGB");
            pix.ColorSpace = ColorSpace.CMYK;
            pix.TransformColorSpace(ColorProfile.CoatedFOGRA39, ColorProfile.AdobeRGB1998);
            pix.ColorSpace = ColorSpace.RGB;
            color1 = pix.Histogram().First().Key;
         }