在Android开放式Jpeg - 我得到一个OutOfMemoryException [英] Opening jpegs on Android - I get an OutOfMemoryException

查看:155
本文介绍了在Android开放式Jpeg - 我得到一个OutOfMemoryException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的应用程序需要处理由Android的内置应用程序拍摄的图像。他们保存在JPEG格式,我需要访问每个像素。我试图创建JPEG图像在位图实例,但很多时候我得到一个 OutOfMemoryException异常。我不能调整大小或裁剪图像。是否解决存在?

In my application I need to process images taken by Android's built-in applications. They're saved into JPEG format, and I need to get access to each pixel. I tried to create a Bitmap instance from the jpeg image, but very often I get an OutOfMemoryException. I can't resize or crop image. Does a solution exist?

推荐答案

检查出的 Bitma pregionDe codeR 。这是因为提供API级别10.您可以去一个图像文件的code零件和处理每个块。

Check out BitmapRegionDecoder. It is available since API level 10. You can decode parts of an image file and process each chunk.

这篇关于在Android开放式Jpeg - 我得到一个OutOfMemoryException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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