Re: NSBitmapImageRep and alpha channel
Re: NSBitmapImageRep and alpha channel
- Subject: Re: NSBitmapImageRep and alpha channel
- From: James Merkel <email@hidden>
- Date: Sun, 13 Nov 2011 12:50:44 -0800
On Nov 13, 2011, at 12:34 PM, Quincey Morris wrote:
> On Nov 13, 2011, at 11:11 , James Merkel wrote:
>
>> This is kind of interesting -- if I rotate the image in Preview (rather than Image Capture), then the histogram looks normal.
>> Looking at the NSBitmapImageRep from Preview image, the order is RGBA and there is no reported alpha channel.
>> Furthermore for the Preview rotated image, the Exif Orientation tag says normal (horizontal), and the width and height are reported correctly.
>> For the Image Capture rotated image, the Exif Orientation tag says rotated 90 degrees and the width and height are reversed (i.e. not reported correctly).
>> I think Preview is doing the right thing and Image Capture is doing the wrong thing.
>> Why I get a bad histogram from the IMage Capture rotated image I'm not sure.
>
> The implication of this is likely that you're misinterpreting the pixel format of the Image-Capture-rotated image. (For example, did it change the component values from 8-bit to 16-bit components or to floats, or something like that?). In principle, it shouldn't be too hard to resolve. Simply examining the data, or substituting a test image with known, predictably-arranged colors, should let you see why your histogram calculation doesn't match.
NSBitmapImageRep reports that the image is 32-bits per pixel, 8-bits per sample and the pixel values are integers.
I have tried some simple one-color test images created in Photoshop Elements. They produce correct histograms.
The Photoshop test images are 24-bits per pixel. I'm not sure I have control over making them 32-bits with an alpha channel.
I'll have to look into it.
Jim Merkel
_______________________________________________
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