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??
0
votes
2 Answers
0
votes
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.
0
votes