Re: NSImage/NSBitmapImageRep color shifts when creating scaled copy
Re: NSImage/NSBitmapImageRep color shifts when creating scaled copy
- Subject: Re: NSImage/NSBitmapImageRep color shifts when creating scaled copy
- From: Steve Christensen <email@hidden>
- Date: Fri, 06 Mar 2009 13:46:11 -0800
On Mar 6, 2009, at 1:15 PM, Kyle Sluder wrote:
On Fri, Mar 6, 2009 at 2:21 PM, Steve Christensen <email@hidden>
wrote:
I'm trying to create a scaled-down copy of a large
NSBitmapImageRep (i.e.,
3200x2400 -> 320x240). The smaller image eventually gets passed to
OpenGL
for drawing. What I'm finding is that the copy has color shifted.
When I
draw the copy, it appears to be darker and more saturated than the
original.
Sounds like you're falling victim to this problem:
http://www.4p8.com/eric.brasseur/gamma.html
In this case what I found out was running into a difference of
opinion between the ColorSync profile attached to the
NSBitmapImageRep in the source image and the default one (or lack of
one) for a newly-created NSBitmapImageRep in the resized image.
I ended up rewriting my code to create a new NSBitmapImageRep with
the destination size, then copy what I thought were relevant
properties (NSImageRGBColorTable, NSImageColorSyncProfileData,
NSImageGamma) from the source NSBitmapImageRep if they exist. Then
create a context using +[NSGraphicsContext
graphicsContextWithBitmapImageRep:] using the destination
NSBitmapImageRep and draw into that.
steve
_______________________________________________
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