How to get the Size (KB) of UIImage

后端 未结 2 1138
野趣味
野趣味 2021-02-07 12:05

I am getting Image from didFinishPickingMediaWithInfo.

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


        
2条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-07 12:17

    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 
    
    NSLog(@"Size of %@: %zd", NSStringFromClass([originalImage class]), malloc_size((__bridge const void *)originalImage));
    

提交回复
热议问题