Has My Image Been Premultiplied?
Has My Image Been Premultiplied?
- Subject: Has My Image Been Premultiplied?
- From: Jason Harris <email@hidden>
- Date: Thu, 20 Feb 2003 14:03:31 -0700
Hi List!
Apple's docs state that all NSBitmapImageRep objects that contain alpha
should be premultiplied. Accordingly, when I read an image in from a
filesystem TIFF using [NSImage initWithContentsOfFile:], I generally find
that the runtime premultiplies the image for me.
Here's the problem: sometimes it doesn't. I tested this with about 50
different images and found that about 90% of the time, the final image was
premultiplied, but that 10% that isn't is the kicker.
So, my question is how can I determine definitively whether the runtime has
premultiplied the image for me?
I suspect that the runtime only premultiplies images for which certain
criteria are true - criteria like the infamous "has extra samples,
premultiplying" thing that shows up in the console periodically.
It seems that the primary criteria that the runtime uses to determine
whether to premultiply is whether any r, g, or b sample value is greater
than the associated alpha sample value. If so, the image is premultiplied.
I tested this by adding a single pixel of 100% red to a fully-masked area of
an image that the runtime was not premultiplying - this caused the runtime
to premultiply it.
So basically, I need an all-or-nothing approach. If the runtime is going to
premultiply images for me, it needs to do all of 'em. Or none of 'em and
I'll do it myself. Or I need a way to know whether it's done it for me.
Thanks for your help!
Jason Harris
Geekspiff
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.