How do I convert a color NSImage to grayscale?
site_archiver@lists.apple.com Delivered-To: cocoa-dev@lists.apple.com Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=oCYOAwAVOSD1xTw1crLfQvh7ty0ZiOyzf/UIOxTJdjTiIKDQAGzyLdlnQB0+ftWa8ps9qVblNk9OaI5C4P+xYVzF1rZaVCbzW8jLeONuoOA+rlKxe9j/0g0bKaUWUeRY6gbYtLLkuwQ3MH0n0un3uoMod1UCMw2BfOJzcyDn+DY= 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 (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/site_archiver%40lists.apple... This email sent to site_archiver@lists.apple.com
participants (1)
-
Alan Smith