我正在从didFinishPickingMediaWithInfo获取图像。

UIImage *originalImage = (UIImage*)[info valueForKey:UIImagePickerControllerOriginalImage];

我想以Kb为单位获取图像的大小。

最佳答案

    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;

关于ios - 如何获取UIImage的大小(KB),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/14957039/

10-10 20:53