简体   繁体   中英

How to get date and filesize from a picture?

If pictures are loaded into an app from a album, how is it possible to get the filesize in MB and the date of that picture displayed on a app like on the screenshot below?

在此处输入图片说明

I know you can retrieve the filesize via a NSLog using the following code, but how can I get this into a string and also the date of that picture?

NSLog(@"size of image in KB: %i",[UIImagePNGRepresentation(UIImage) length]);

Use CoreGraphics

size_t imageSize = CGImageGetBytesPerRow(image.CGImage) * CGImageGetHeight(image.CGImage);

iOS get UIImage memory size

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM