How to get the Size (KB) of UIImage How to get the Size (KB) of UIImage xcode xcode

How to get the Size (KB) of UIImage


    UIImage *originalImage = (UIImage*)[info valueForKey:UIImagePickerControllerOriginalImage];    NSData *imgData = UIImageJPEGRepresentation(originalImage, 1); //1 it represents the quality of the image.    NSLog(@"Size of Image(bytes):%d",[imgData length]);    imgData = nil;


I think the op's size (kb) is the memory size of originalImage, right?

Check out the usage about malloc_size under the ARC refer to this.

#import <malloc/malloc.h>NSLog(@"Size of %@: %zd", NSStringFromClass([originalImage class]), malloc_size((__bridge const void *)originalImage));