Android图片文件大小限制以及如何处理大图片? [英] Android image file size limit and how to handle large images?

查看:820
本文介绍了Android图片文件大小限制以及如何处理大图片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我们使用大图像(位图),我们最终会以允许图像的大小(为了显示)来碰壁。我想知道是否有人知道这个限制在哪里?这有很多因素,手机的最大堆大小等。

If we work with large images (bitmaps) we will hit a wall eventually in the size the image is allowed to be (in order to be displayed). I wondered if anyone knows where this limit is? There is many factors in this, the maximum heap size of the phone etc.

如果要显示大图像并使它们相互作用,还有解决方法吗? -able?

Also is there any workaround to handling large images if you want to display them and make them interact-able?

推荐答案

如果您已经有解码图像数据,可以将它们存储在存储空间
的文件中,然后mmap这个缓冲区。

If you already have decoded image data, you can store them in file on storage and then mmap this buffer.

然后你可以通过 createBitmap function

MMapped内存区域不再计数堆,不受垃圾收集
的影响,并由寻呼子系统绕过通常的文件操作处理。

MMapped memory areas do not count agains heap, are not subject for garbage collection and are handled by paging subsystem bypassing usual file operations.

这篇关于Android图片文件大小限制以及如何处理大图片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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