德$ C C位图从文件中Android的一部分$ [英] Decode a part of Bitmap from file in Android

查看:92
本文介绍了德$ C C位图从文件中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

感谢

推荐答案

我不认为你可以。甚至没有在PC上,我看不出你如何能做到这一点,而无需加载整个图像:大多数图像格式,例如PNG格式,具有像素数据压缩,所以你至少需要解压缩IDAT块,然后才可以开始做别的和C整个图像基本上都会去$ C $。

I don't think you can. Not even on a PC, I fail to see how you could do that without loading the entire image: most image formats, for example PNGs, have the pixel data zipped, so you need to at least unzip the IDAT chunk before you can start doing anything else and that will basically decode the whole image.

在你的鞋我会尝试有一台服务器为我做的。你在哪里反正拿到的形象呢?不从一台服务器?然后尽量让WS请求,这将使你的图像正确的部件。如果图像不是来自服务器,你仍然可以将其发送到服务器,以获得您想要的图像的背面只有部分。

In your shoes I would try to have a server do it for me. Where do you get the image anyway? Not from a server? Then try to make a WS request that will give you the proper part of the image. If the image does NOT come from the server you can nevertheless send it to your server to get back only the part of the image that you want.

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

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