Getting RGB pixel data from CGImage
I am trying to access pixel data from a CGImage. I want to be able to access the RGB values as integers. I think I am nearly there with this code: UIImage* theImage = [UIImage imageNamed:@"rgb.png"]; CGImageRef cgImageRef = CGImageRetain(theImage.CGImage); CFDataRef* imageData = CGDataProviderCopyData(CGImageGetDataProvider(cgImageRef)); NSLog(@"the data = %@", imageData); This then logs: the data = <010002fe fffdff02 0200fe04 0003fc> The image is a 5x1 png containing a black, white, red, green and blue pixel in that order. I don't really understand what I am looking at here. How can I get an