How do I convert a color NSImage to grayscale?
How do I convert a color NSImage to grayscale?
- Subject: How do I convert a color NSImage to grayscale?
- From: "Alan Smith" <email@hidden>
- Date: Sun, 31 Dec 2006 16:37:44 -0500
Hi all,
I'm looking to write a category on NSImage that will return a
grayscale image of itself. I've "done my research" and found a
previous post on this list.
http://www.cocoabuilder.com/archive/message/cocoa/2006/11/3/173921
But not knowing much about raw image data I got lost when trying to do
as Ricky suggested. Here is what he said:
Take a look at the the following sample:
<http://developer.apple.com/samplecode/Monochrome_Image/index.html>
It shows how to apply the NTSC grayscale algorithm. However, it
doesn't use direct-pixel access, so will be very slow. Thus, convert
it to use direct-pixel-access like the following sample shows:
<http://developer.apple.com/samplecode/Transformed_Image/index.html>
Also definitely take a look at CoreImage where you could write your
own grayscale filter to ignore pixels in your color 'range'.
--
Rick Sharp
I want the conversion to work on 10.2.8 so I've ruled out the
CoreImage solution. If someone can explain raw image data enough so
that I can do as Ricky suggests on my own or if someone can give me an
example, that would be super.
Your help will be appreciated.
Peace, Alan
--
// Quotes from yours truly -------------------------
"You don't forget, you just don't remember."
"Maturity resides in the mind."
"Silence is the Universe's greatest gift."
"When the World realizes that religion really is unnecessary, then it
shall evolve."
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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