Reputation: 27325
Given a UIImage object, I want to programmatically multiply the R, G, B, and A components of its colors by fixed constants. So, for instance, if I choose 1,0,0,1 for my constants, I would basically grab the red component of the image, while discarding the rest.
Is there an easy way to do that?
Upvotes: 0
Views: 410
Reputation: 646
Some quick searching brought up this tutorial:
http://brandontreb.com/image-manipulation-retrieving-and-updating-pixel-values-for-a-uiimage/
From what I can see, that tutorial involves drawing the UIImage onto a buffer in memory, manipulating that buffer, then transferring the pixel data from that back to the UIImage.
Basically, there's no simple way to do that with any of the methods of UIImage.
Upvotes: 1