0

I want to use the .icc Profile "ISOnewspaper26v4.icc" in C# ! But I have a problem now.. I don't know how to convert CMYK colors to Lab values or RGB to Lab values by using this ICC Profile ??!! How I can assign the profile??

Tae-Sung Shin
  • 20,215
  • 33
  • 138
  • 240
Maxim
  • 317
  • 1
  • 5
  • 13

2 Answers2

0

To my knowledge, C# and the associated libraries don't contain any functions for converting CMYK or RGB to Lab. The contain functions for converting CMYK to RGB (see this answer).

The Windows API seems to have functions for converting between different color systems. It at least works for converting RGB to CMYK (see this answer).

You probably need to following extensions:

    [StructLayout(LayoutKind.Sequential)]
    public struct LabCOLOR
    {
        public ushort L;
        public ushort a;
        public ushort b;
        public ushort pad;
    };

    [DllImport("mscms.dll", SetLastError = true, CallingConvention = CallingConvention.Winapi)]
    static extern bool TranslateColors(
        IntPtr hColorTransform,
        [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2), In] RGBColor[] inputColors,
        uint nColors,
        ColorType ctInput,
        [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 2), Out] LABColor[] outputColors,
        ColorType ctOutput);

Then you should be able to replace "cmyk" with "lab" to convert from RGB to Lab colors. I haven't tried it though.

Community
  • 1
  • 1
Codo
  • 75,595
  • 17
  • 168
  • 206
  • Du you know, whether I can import a specific ICC Profile in "mscms" to convert this colors. I know that it is possible in LittleCMS but I have never never worked with pInfoke references. – Maxim Feb 28 '13 at 09:30
0

It should be possible to "convert" to CIE Lab with the help of a Lab space ICC profile. AGFA used to have one. Otherwise, one would have to write a routine to manually make the conversion, outside of ICM, through the A2B0 tag, for an output profile. Beware, that ISOnewspaperv4 profile is finacky.

Roger Breton
  • 81
  • 1
  • 9