UIImage has a read-only property CGImage. I have to read its pixels to a memory block and edit them and then make a new UIImage to replace the old one. I want to know if th
The short answer is no. However, you say you have to make a copy anyhow, so why not just get an NSData object and manipulate its bytes.
From the Apple docs on UIImage:
Because image objects are immutable, they also do not provide direct access to their underlying image data. However, you can get an NSData object containing either a PNG or JPEG representation of the image data using the UIImagePNGRepresentation and UIImageJPEGRepresentation functions.
To get the data as a PNG, use:
NSData * UIImagePNGRepresentation (
UIImage *image
);
for JPEG, use:
NSData * UIImageJPEGRepresentation (
UIImage *image,
CGFloat compressionQuality
);