Note that there are some explanatory texts on larger screens.

plurals
  1. POcolor conversion CMYK - RGB - Lab with WCS by using a ICC Profile
    text
    copied!<p>Since last week I try to use the Windows Color System for my color conversion. By the conversion from CMYK to RGB i get the correct values:</p> <pre><code> // Example CMYK - VALUES with 0 float[] cmykValues = new float[4]; cmykValues[0] = 0f / 255f; cmykValues[1] = 0f / 255f; cmykValues[2] = 0f / 255f; cmykValues[3] = 0f / 255f; System.Windows.Media.Color color = Color.FromValues(cmykValues, new Uri(@"ISOcoated_v2_300_eci.icc")); System.Drawing.Color rgbColor = System.Drawing.Color.FromArgb(color.R, color.G, color.B); </code></pre> <p>When I try to convert the RGB Values to Lab Values, then I get a incorrect Lab - Result:</p> <pre><code>[StructLayout(LayoutKind.Sequential)] public struct RGBColor { public ushort red; public ushort green; public ushort blue; public ushort pad; }; [StructLayout(LayoutKind.Sequential)] public struct LABColor { public ushort L; public ushort a; public ushort b; public ushort pad; }; StringBuilder profileName = new StringBuilder(256); uint size = (uint)profileName.Capacity * 2; success = GetStandardColorSpaceProfile(0, LogicalColorSpace.sRGB, profileName, ref size); ProfileFilename sRGBFilename = new ProfileFilename(profileName.ToString()); IntPtr hSRGBProfile = OpenColorProfile(sRGBFilename, ProfileRead, FileShare.Read, CreateDisposition.OpenExisting); ProfileFilename isoCoatedFilename = new ProfileFilename(@"ISOcoated_v2_300_eci.icc"); IntPtr hIsoCoatedProfile = OpenColorProfile(isoCoatedFilename, ProfileRead, FileShare.Read, CreateDisposition.OpenExisting); IntPtr[] profiles = new IntPtr[] { hSRGBProfile, hIsoCoatedProfile }; uint[] intents = new uint[] { IntentPerceptual }; IntPtr transform = CreateMultiProfileTransform(profiles, 2, intents, 1, ColorTransformMode.BestMode, IndexDontCare); RGBColor[] rgbColors = new RGBColor[1]; rgbColors[0] = new RGBColor(); LABColor[] labColors = new LABColor[1]; labColors[0] = new LABColor(); rgbColors[0].red = Convert.ToUInt16(rgbColor.R * 257); rgbColors[0].green = Convert.ToUInt16(rgbColor.G * 257); rgbColors[0].blue = Convert.ToUInt16(rgbColor.B * 257); success = TranslateColors(transform, rgbColors, 1, ColorType.RGB, labColors, ColorType.Lab); double colorL = Convert.ToDouble(labColors[0].L) / 65535; double colorA = Convert.ToDouble(labColors[0].a) / 65535; double colorB = Convert.ToDouble(labColors[0].b) / 65535; </code></pre> <p>When I convert the CMYK Value (0;0;0;0) to RGB (= 254:254;254) and the RGB Value to Lab I get the following values:</p> <pre><code>L = 0.0039978637360036373 a = 0.002777141984552145 b = 0.0030670634005218744 </code></pre> <p>But the L-Value should be about 100%</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload