Possible Duplicate:
How to get pixel data from a UIImage (Cocoa Touch) or CGImage (Core Graphics)?
Let’s say I have a UIImage that I would like to get the rgb matrix of, in order to do some processing on it, not to change it, just get the UIImage data so i can use my C algorithms on it.
As you probably know, all the math is done on the image rgb matrixes.
The basic procedure is to create a bitmap context with
CGBitmapContextCreate, then draw your image into that context and get the internal data withCGBitmapContextGetData. Here’s an example: