我从didFinishPickingMediaWithInfo
获得了图片。
UIImage *originalImage = (UIImage*)[info valueForKey:UIImagePickerControllerOriginalImage];
我想在Kb中获得Image的大小。
答案 0 :(得分:24)
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;
答案 1 :(得分:0)
我认为操作size (kb)
是originalImage
的内存大小,对吗?
查看ARC下malloc_size
的使用情况,请参阅this。
#import <malloc/malloc.h>
NSLog(@"Size of %@: %zd", NSStringFromClass([originalImage class]), malloc_size((__bridge const void *)originalImage));