How to get Size of UIImage in Bytes in iOS 4.0+?

后端 未结 4 1114
北恋
北恋 2021-02-08 08:01

I am trying to pick an image from the photo library or from the camera.
The delegate method:

- (void)imagePickerController:(UIImagePickerController *)picker d         


        
4条回答
  •  情歌与酒
    2021-02-08 08:14

    Try the following code:

    NSData *imageData = [[NSData alloc] initWithData:UIImageJPEGRepresentation((image), 1.0)];
    
    int imageSize = imageData.length;
    NSLog(@"SIZE OF IMAGE: %i ", imageSize);
    

提交回复
热议问题