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

NSImage/NSBitmapImageRep color shifts when creating scaled copy


  • Subject: NSImage/NSBitmapImageRep color shifts when creating scaled copy
  • From: Steve Christensen <email@hidden>
  • Date: Fri, 06 Mar 2009 11:21:51 -0800

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.

I have tried several ways to get a copy that has the same color characteristics as the original but no success so far. My simplest version looks like this:

NSRect resizedBounds = {NSZeroPoint, desiredBitmapSize};
NSImage* resizedImage = [[[NSImage alloc] initWithSize:resizedBounds.size] autorelease];


[resizedImage lockFocus];
[[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationHigh];
[image drawInRect:resizedBounds fromRect:NSZeroRect operation:NSCompositeCopy fraction:1.0];
[resizedImage unlockFocus];


bitmapImage = [NSBitmapImageRep imageRepWithData:[resizedImage TIFFRepresentation]];


Am I missing something or is this just how Quartz works? Is there another way to get there? I'm not wedded to NSImage and friends if a better solution exists elsewhere. This needs to run on 10.4 or later.


Thanks,
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


  • Follow-Ups:
    • Re: NSImage/NSBitmapImageRep color shifts when creating scaled copy
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Re: Newbie query re notifications
  • Next by Date: NSDrawNinePartImage draws slowly in CALayer
  • Previous by thread: Re: Moving a window offscreen
  • Next by thread: Re: NSImage/NSBitmapImageRep color shifts when creating scaled copy
  • Index(es):
    • Date
    • Thread