I need to zero out one of the color channels in an NSImage, whats the right way to do this?
问题 I want to achieve the same result as if I were in photoshop and turned off one of the channels. I was about to try to loop through every pixel changing colors. Is there a better way to do this? 回答1: Use Core Image's Color Matrix filter. The array of vectors can be bewildering, but it's very powerful. In your case, you'll want to set the vector for the channel you want to turn off to all-zeroes. Obviously, this will only work for RGB images, since Core Image only works for RGB images. You can