• 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: NSImage/NSBitmapImageRep color shifts when creating scaled copy
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >NSImage/NSBitmapImageRep color shifts when creating scaled copy (From: Steve Christensen <email@hidden>)
 >Re: NSImage/NSBitmapImageRep color shifts when creating scaled copy (From: Kyle Sluder <email@hidden>)

  • Prev by Date: Re: Why is my UIColor white actually gray?
  • Next by Date: Re: How to change the Installer.app path of files in a XCode project
  • Previous by thread: Re: NSImage/NSBitmapImageRep color shifts when creating scaled copy
  • Next by thread: NSDrawNinePartImage draws slowly in CALayer
  • Index(es):
    • Date
    • Thread