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

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Post Reply
Mic
Posts: 2
Joined: 2020-02-07T02:59:54-07:00
Authentication code: 1152

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

Post 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 ).

?

snibgo
Posts: 12904
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post by snibgo »

As far as I know, the only way to do this is by creating an image, eg 1x1 pixel, and converting that.
snibgo's IM pages: im.snibgo.com

Mic
Posts: 2
Joined: 2020-02-07T02:59:54-07:00
Authentication code: 1152

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

Post by Mic »

Thanks for replay, but I need something faster.

snibgo
Posts: 12904
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post by snibgo »

Perhaps an LCMS function can do that.
snibgo's IM pages: im.snibgo.com

SLS8
Posts: 6
Joined: 2020-03-03T11:26:22-07:00
Authentication code: 1152

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

Post 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;
         }

Post Reply