tags:

views:

267

answers:

2

My app creates NSImages by compositing various other NSImages together. The original images are loaded from files using [NSBitmapImageRep imageRepWithContentsOfFile:]. The final image is then displayed on the screen.

A few 10.6 customers have reported that the image they see (sometimes) has shifted colors. Specifically, all of the bright colors look dull and washed out. Blue seems to be shifted in the purple direction.

I know this must have something to do with NSImage or NSBitmapImageRep's handling of colorspaces, gamma, or ColorSync? I know there were gamma changes in Snow Leopard.

Does anyone know where I should start? It's hard to troubleshoot because I can't reproduce the problem, but I can see form the customers' screenshots that the colors aren't right.

Anyone seen this before?

+1  A: 

Snow Leopard changed the default gamma: http://support.apple.com/kb/HT3712

Rob Napier
I saw this, but how does this apply to my problem? Can you suggest a solution?
Ken Aspeslagh
I would suspect that if only a few 10.6 customers are having trouble (rather than all 10.6 users), then they are mixing images with an embedded gamma with ones that do not have one. You'll probably want to add ColorSync profiles. See http://developer.apple.com/mac/library/qa/qa2004/qa1369.html and http://developer.apple.com/mac/library/technotes/tn/tn2035.html
Rob Napier
I'll look into those links. In this app, the users aren't supplying their own images. It's just a built-in set of images that get composited onto a backing image. The PNG images I'm compositing don't have ColorSync profiles, but Preview shows a few different values for "Color Space" in the Exif tab. The backing image comes from an icns file and has a "Generic RGB Profile" ColorSync Profile.
Ken Aspeslagh
+2  A: 

Blue seems to be shifted in the purple direction.

This is a bug in Snow Leopard. Anything approximately blue drawn in Generic RGB gets color-incorrected to approximately purple. You can even see this in the menu highlights.

http://boredzo.org/screenshots/SnowLeopard-PurpleIsTheNewBlue-MenuSelections.png

(If you don't believe that that's purple, break out DigitalColor Meter. It's most purple near the bottom of the gradient.)

I filed a bug report: x-radar://problem/7542845. I included plenty of photographic and videographic evidence, which you can see in the OpenRadar copy. I invite you to file a duplicate.

It doesn't happen for everybody; if the above image looks fine for you, watch the video, which has the red-shift baked in from the video conversion and shows the difference in DCM.

Peter Hosey
The screenshots these customers send me shift light blue to purple, but also all the bright colors look significantly different, like solid red has become maroon and bright purple has become a blueish-purple. They say that it seems to fade over time and quitting and re-opening the app make it go back to normal. This is an image that I redraw quite often. I wonder if the cache gets shifted slightly each time I draw it.Have you found a good workaround? Would a solution be to not use Generic RGB?Meanwhile, I'm going to ask these customers what kind of display they're using.
Ken Aspeslagh
“I wonder if the cache gets shifted slightly each time I draw it.” Sounds plausible. Something like that, anyway (perhaps you're capturing the output and using it as input later?). “Have you found a good workaround? Would a solution be to not use Generic RGB?” Using the main display's color space should be an effective workaround.
Peter Hosey
Whoa, I just reproduced this by changing my display profile (on my iMac) to "Adobe RGB (1998)" while the program was running. (Although I can't yet repro it a second time. I'll keep you posted when I figure out what's going on!
Ken Aspeslagh
It looks like if I start the app while set to Generic RGB, and then change my display's profile to anything else, then redraw the composited image, I get wildly shifted colors. I'll bet these customers are starting out using their computer's main display, then plugging in an external monitor which switches their main display to a different profile.
Ken Aspeslagh
It looks like I'm seeing the shift when my app is creating an NSImage when the display color profile is Generic RGB, and then holding onto it. If it gets drawn again after the color profile changes, the colors are all wrong. This only happens on 10.6; the colors don't change in 10.5 with the same steps.
Ken Aspeslagh