我从didFinishPickingMediaWithInfo
.
UIImage *originalImage = (UIImage*)[info valueForKey:UIImagePickerControllerOriginalImage];
我想以 Kb 为单位获取 Image 的大小。
我从didFinishPickingMediaWithInfo
.
UIImage *originalImage = (UIImage*)[info valueForKey:UIImagePickerControllerOriginalImage];
我想以 Kb 为单位获取 Image 的大小。
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;
我认为 op 的size (kb)
内存大小是originalImage
,对吧?
查看malloc_size
ARC 下的用法,请参阅this。
#import <malloc/malloc.h>
NSLog(@"Size of %@: %zd", NSStringFromClass([originalImage class]), malloc_size((__bridge const void *)originalImage));