• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSColor (RGB) from Lab values?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSColor (RGB) from Lab values?


  • Subject: Re: NSColor (RGB) from Lab values?
  • From: Glenn Andreas <email@hidden>
  • Date: Thu, 17 Jun 2004 13:33:34 -0500

At 6:13 PM +0200 6/17/04, b UND d wrote:
I want to have colors with given Lab values correctly displayed (= converted to RGB NSColors).

As far as i know NSColor does not support Lab color space. Is there a convenient way to convert the Lab values to RGB?
I thought of ColorSync but i found only 'CMConvertLabToXYZ' and no way further to RGB.

I found some math for converting Lab -> XYZ -> RGB at www.easyRGB.com - but the results of this formula slightly differ from what PhotoShop sais (all calculated colors are too bright).

Many thanks in advance for any help

Dominik

Typed in mail, no error checking:

CMProfileRef srcProfile, dstProfile;
CMGetDefaultProfileBySpace(cmLabData,&srcProfile);
CMGetDefaultProfileBySpace(cmRGBData,&dstProfile);
CMWorldRef colorWorld;
NCWNewColorWorld(&colorWorld, srcProfile, dstProfile);
CMColor color;
color.Lab = srcRGBColor;
CWMatchColors(colorWorld, &color, 1);
CWDisposeColorWorld(colorWorld);
CMCloseProfile(srcProfile);
CMCloseProfile(dstProfile);
// do whatever you need with the resulting color.RGB


If you've got a bunch of colors to convert all at once (it sounds like you might have an array of them that you are displaying) you can use an array of CMColors and convert them all at once.


--
Glenn Andreas email@hidden mondo blobbo, Cythera, Theldrow, oh my!
Mad, Bad, and Dangerous to Know
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >NSColor (RGB) from Lab values? (From: b UND d <email@hidden>)

  • Prev by Date: Re: sin(4*pi^2*t) 0 >= t <= pi/3, can you read this ?
  • Next by Date: Controlling Volume with NSSound?
  • Previous by thread: NSColor (RGB) from Lab values?
  • Next by thread: / two questions /
  • Index(es):
    • Date
    • Thread