Re: Drawing NSImage in grayscale
Re: Drawing NSImage in grayscale
- Subject: Re: Drawing NSImage in grayscale
- From: Tom Waters <email@hidden>
- Date: Sun, 2 Dec 2001 12:21:12 -0800
gray = .56g + .33r + .11b as i recall.
On Saturday, December 1, 2001, at 01:33 PM, John C. Randolph wrote:
On Saturday, December 1, 2001, at 10:35 AM, Peter Ammon wrote:
On Friday, November 30, 2001, at 05:13 PM, Peter Ammon wrote:
Are there any easy techniques (e.g. compositing operations,
perhaps in several passes) for drawing a color NSImage
instantiated from a tiff file in grayscale?
The only way I can think of would be to create an
NSBitmapImageRep with one data plane and draw into that.
Thanks for any ideas!
-Peter
I went ahead and implemented my idea, so here it is in case
someone else can get use out of it. It seems to work for the
meshed images I've tried; I haven't tested it with planar
images.
Peter,
Your code will give a good approximation, but I suggest that you
have a look in Newman & Sproul for the standard RGB weighting
function. Basically, we're much more sensitive to light in the
green band than the blue, and there is a formula that accounts
for this.
-jcr
"Only in a police state is the job of a policeman easy." - Orson Welles
_______________________________________________
cocoa-dev mailing list
email@hidden
http://www.lists.apple.com/mailman/listinfo/cocoa-dev