简体   繁体   English

将大位图加载到字节数组中

[英]Load large bitmap into byte array

I am getting an OOM error from loading a large bitmap using BitmapFactory.decodeResource. 使用BitmapFactory.decodeResource加载大位图时,出现OOM错误。 I have seen other suggestions about compressing the image but for my app, preserving quality is absolutely necessary. 我还看到了其他有关压缩图像的建议,但是对于我的应用程序,保持质量绝对是必要的。 Eventually I need to get the image into a byte/pixel array. 最终,我需要将图像放入字节/像素数组。 Is there any way to get all of the pixels into an array without having to reduce quality or 'tile' the bitmap? 有什么方法可以将所有像素放入阵列中,而不必降低质量或“平铺”位图?

Also, I don't need to keep the bitmap, only the byte array (or an array of pixels). 另外,我不需要保留位图,只需保留字节数组(或像素数组)。 The code I'm writing will search the array. 我正在编写的代码将搜索数组。 It will all eventually be implemented into a more complex app (written by someone else, hence my inexperience with android). 最终所有这些都将实现为一个更复杂的应用程序(由其他人编写,因此我对android缺乏经验)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM