Re: Color matching of NSBitmapImageRep
Re: Color matching of NSBitmapImageRep
- Subject: Re: Color matching of NSBitmapImageRep
- From: Scott Thompson <email@hidden>
- Date: Thu, 30 Aug 2007 08:21:08 -0500
On Aug 29, 2007, at 7:54 PM, Wim Lewis wrote:
I've been trying to track down some unexpected color shifts in a
supposedly color-sync'd application. I've discovered that
NSBitmapImageRep is not rendering its colors at all in the way that
I expect. It seems to be using a different color profile than the
one I tell it to. Can anyone tell me how to get a bitmap to draw
color-matched?
Everything that goes through a Quartz context is color matched.
As an example, let's say that I have an NSColor (or CGColorSpaceRef
+ components, but that's by the way). I want to set some pixels of
an NSBitmapImageRep to that same color, so that when I draw them
side-by-side they render as the same color on the screen.
Where does your CGColorSpaceRef come from? Where do the components
come from? If this is the color you are trying to match, these hardly
seem like points of information to leave by the wayside :-)
- Convert the color to the calibrated RGB space by calling [foo
colorUsingColorSpaceName: NSCalibratedRGBColorSpace].
If you know the source color space for your components, why don't you
use that same color space to create your bitmap image? That way
you're taking the shortest route. Here you're adding an what looks to
be an unnecessary extra conversion that might shift your color slightly.
So, what I wonder is:
- Why isn't the NSBitmapImageRep rendering its contents in the
color space I ask it to?
The color space you pass in to NSBitmapImageRep is the source color
space, not the destination color space. The NSBitmapImageRep is
rendering it's contents in whatever destination space you draw that
bitmap into. The mapping from the NSCalibratedRGBColorSpace, and the
mapping of whatever mystery color space your original color components
were found in, to the destination space are not exactly the same.
- What color space *is* it using?
What end of the rendering process are you referring to? What its the
source color space for the color samples? In your example code it
looks to be the NSCalibratedRGBColorSpace. The destination color
space, however, depends on how you've set up your system and what
display profile you are using.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden