We can use NSData’s length method for this. Imagine your UIImage is yourImage:
NSData *imageData = UIImageJPEGRepresentation(yourImage, 1); NSLog(@"Size of your image is %d bytes", [imageData length])
[imageData length] returns a double in bytes, which will be the size of your image.
This is useful if you’d like to save something and you’re limited in size, such as iCloud Key Value storage where a data object may only be 1MB in size or smaller.