Re: Help with NSBitmapImageRep, please
Re: Help with NSBitmapImageRep, please
- Subject: Re: Help with NSBitmapImageRep, please
- From: Graham Cox <email@hidden>
- Date: Fri, 31 Oct 2008 11:44:13 +1100
On 31 Oct 2008, at 11:12 am, M Pulis wrote:
<Error>: CGBitmapContextCreate: unsupported parameter combination:
16 integer bits/component; 48 bits/pixel; 3-component colorspace;
kCGImageAlphaNone; 7206 bytes/row.
<Error>: CGContextScaleCTM: invalid context
So, what is wrong am I missing here?
What it says. You can't have 16 bits per pixel RGB bitmaps, they are
not supported.
You can have 16 bits per pixel monochromatic images, or you can have 8
bits per pixel RGB. If you want to convert your 16 bit image to RGB,
you will have to compress it down to 8 bits - you can do that simply
by taking the top 8 bits of each 16 bit pixel and replicating it
across the three R, G and B components. Of course you'll lose a lot of
dynamic range, but the image will look roughly the same.
Also, GetPixel/SetPixel are very slow - you'll be better off just
doing the conversion on a raw block of memory and wrapping a bitmap
rep around it when you're done.
hth, Graham
_______________________________________________
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