(iphone)将png加载到UIImage比png二进制大小占用更多的内存? [英] (iphone) loading png to UIImage takes up more memory than png binary size?

查看:92
本文介绍了(iphone)将png加载到UIImage比png二进制大小占用更多的内存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在加载100个4k-8k png文件(768 * 768分辨率),总计少于1mg.

I'm loading 100s 4k-8k png files(768*768 resolution), total less than 1mg.

尽管我确实将它们转换为UIImage并偶尔调整了图像的大小/组合,
看到ipad设备因图像加载而发出内存警告,我感到很惊讶.

Although I do convert them to UIImage and resize/combine images occasionaly,
I was surprised to see ipad device die because of memory warning due to the image loadings.

转换为UIImage是否比文件的实际字节大小占用更多的内存?

Is converting to UIImage takes up much more memory than actual byte size of the file?

谢谢.

推荐答案

这是因为png被解压缩到内存中,从而占用了更多内存.每个解压缩的图像将占用768 * 768 * 4 = 2.25 MByte的内存.

That's because png's are decompressed into memory, taking more memory. And each decompressed image will take up to 768*768*4 = 2.25 MByte of memory.

这篇关于(iphone)将png加载到UIImage比png二进制大小占用更多的内存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆