The document for NSBitmapImageRep says the following:
"Alpha Premultiplication
If a coverage (alpha) plane exists, a bitmap’s color components are 
premultiplied with it. If you modify the contents of the bitmap, you are 
therefore responsible for premultiplying the data. For this reason, though, if 
you want to manipulate the actual data, an NSBitmapImageRep object is not 
recommended for storage.
If you need to work with data that is not premultiplied, you should use Quartz, 
specifically CGImageCreate with kCGImageAlphaLast.
Note that premultiplying does not affect the output quality. Given source 
bitmap pixel s, destination pixel d, and alpha value a, a blend is basically
d' = a * s + (1 - a) * d
All premultiplication does is precalculate a * s."

First question -- what is d' in that equation?
I read images from files and create histograms from them using pixel data from 
the NSBitmapImageRep. 
Things seem to work ok except for images that have an alpha channel (that is, 
bitsPerPixel = 32 from the NSBitmapImageRep, and an alpha channel is present). 
The histograms in that case have gaps in them (certain levels seem to be 
under-represented). 
Some specific images  with this problem were downloaded through Image Capture 
and rotated in Image Capture. 
When an image is rotated in Image Capture, apparently the pixel data is rotated 
and the Exif Orientation tag is changed to reflect the rotation. 
(This is different from what I thought Apple said in previous documentation. I 
thought just the  Exif Orientation tag was changed, and it was up to the image 
display program to rotate the image). 
Anyway, after rotation, the order of the data is ARGB, whereas before the 
rotation the order was RGBA. Also, before the rotation, the alpha channel 
appears to be just an unused channel 
-- i.e. it's not really an alpha channel. Two additional questions: are the 
pixel data premultiplied with the alpha channel? 
Also, for a histogram, should the data be premultiplied with alpha? That is, 
should the histogram reflect the alpha?

Thanks for any help.

Jim Merkel_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to