How to get date and filesize from a picture?

巧了我就是萌 提交于 2019-12-11 20:11:00

问题


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]);

回答1:


Use CoreGraphics

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

iOS get UIImage memory size



来源:https://stackoverflow.com/questions/27453713/how-to-get-date-and-filesize-from-a-picture

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!