• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Drawing NSImage in grayscale
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Drawing NSImage in grayscale
      • From: Tom Waters <email@hidden>
References: 
 >Re: Drawing NSImage in grayscale (From: Peter Ammon <email@hidden>)

  • Prev by Date: Re: Drawing NSImage in grayscale
  • Next by Date: Re: Number Formatting
  • Previous by thread: Re: Drawing NSImage in grayscale
  • Next by thread: Re: Drawing NSImage in grayscale
  • Index(es):
    • Date
    • Thread