• 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: Problem with converting an NSImage to grayscale
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with converting an NSImage to grayscale


  • Subject: Re: Problem with converting an NSImage to grayscale
  • From: "John C. Randolph" <email@hidden>
  • Date: Tue, 30 Aug 2005 07:31:56 -0700


On Aug 30, 2005, at 6:44 AM, Heinrich Giesen wrote:


On 30.08.2005, at 13:06, Arik Devens wrote:



I'm trying to write some code to covert arbitrary RGB and RGBA NSImage's
to grayscale. I've written a routine, which started out as the negative
image sample from ImageDifference but I'm running into some odd problems.


The code works on some images and not others, but I haven't been able to
figure out why some work and some don't.



John C. Randolph answered:


I wrote the Image Difference sample, and the code I have in there to
dig through the pixel data is no longer necessary.  Just use the
monochrome filter from CoreImage.  It will be much faster, since the
processing will happen on the GPU.


Maybe that the monochrom filter from CoreImage is faster but it does not
explain why Ariks code doen't work. Simple answer: his code (clearly influenced
from the ImageDifference code) is wrong because the ImageDifference code
is wrong, especially this "digging through the imaga data".

The Image Difference sample is correct, for versions of OS X prior to Tiger. The point I was making is that it's no longer necessary to do this at all, since CoreImage has a filter that does the RGB to grayscale mapping according to the NTSC formula.


-jcr


John C. Randolph <email@hidden> (408) 914-0013 Roaming Cocoa Engineer, Available for your projects at great Expense and Inconvenience.



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Problem with converting an NSImage to grayscale
      • From: Ricky Sharp <email@hidden>
    • Re: Problem with converting an NSImage to grayscale
      • From: Heinrich Giesen <email@hidden>
References: 
 >Re: Problem with converting an NSImage to grayscale (From: Heinrich Giesen <email@hidden>)

  • Prev by Date: NSScrollView: iPhoto/iTunes border type?
  • Next by Date: RE: NSScrollView: iPhoto/iTunes border type?
  • Previous by thread: Re: Problem with converting an NSImage to grayscale
  • Next by thread: Re: Problem with converting an NSImage to grayscale
  • Index(es):
    • Date
    • Thread