Re: Drawing NSImage in grayscale
Re: Drawing NSImage in grayscale
- Subject: Re: Drawing NSImage in grayscale
- From: "John C. Randolph" <email@hidden>
- Date: Sat, 1 Dec 2001 13:33:36 -0800
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