从Android中的文件解码部分位图 [英] Decode a part of Bitmap from file in Android

查看:27
本文介绍了从Android中的文件解码部分位图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个图像非常大的文件:例如 9000x9000.

I have a file with a very large image: for example 9000x9000.

由于堆大小,我无法在内存中加载位图.但是我只需要显示这个位图的一小部分,例如矩形宽度=100-200和高度=200-400(子位图的结果大小=100x200)

I can't load the Bitmap in memory because the heap size. But I only need to display a small part of this bitmap for example the rect width=100-200 and height =200-400 (resulting size of the sub-bitmap =100x200)

如何从文件中检索此位图?

How can I retrieve this bitmap from the file?

注意:我不想损失 100x200 图像的质量

Note: I dont want to lose quality in the 100x200 image

谢谢

推荐答案

是否有解决方案?

例如,BitmapRegionDecoder.

它应该适用于 API10 及以上...

It should work for API10 and above...

用法:

BitmapRegionDecoder.newInstance(...).decodeRegion(...)

这篇关于从Android中的文件解码部分位图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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