如何图像转换成位平面在android系统? [英] How to convert image into bit plane in android?
本文介绍了如何图像转换成位平面在android系统?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经在Android平台上,这一进程应该逼我的图像转换成位平面的一个项目,但我不知道是怎么code。
I have a project in an android platform that the process should force me to convert image into bit-plane, but I don't know how is the code.
该图片均来自画廊和相机拍摄的。
The images are from gallery and taken from camera.
请帮忙。
推荐答案
试试这个:
String encoded = Base64.encodeFromFile("data/inputImage.png");
//Convert String data to binary image file
Base64.decodeToFile(encoded, "data/outputImage.png");
//Convert binary image file to byte array to base64 encoded string
FileInputStream mFileInputStream = new FileInputStream("data/inputImage.png");
ByteArrayOutputStream bos = new ByteArrayOutputStream();
byte[] b = new byte[1024];
int bytesRead = 0;
while ((bytesRead = mFileInputStream.read(b)) != -1) {
bos.write(b, 0, bytesRead);
}
byte[] ba = bos.toByteArray();
encoded = Base64.encodeBytes(ba);
//Convert String data to binary image file
Base64.decodeToFile(encoded, "data/outputImage.png");
//Convert binary image file to base64 encoded String data file
Base64.encodeFileToFile("data/inputImage.png","data/encodedImage.txt");
//Convert base64 encoded String data file to binary image file
Base64.decodeFileToFile("data/encodedImage.txt","data/outputImage.png");
源代码的http://www.mysample$c$c.com/2011/07/convert-image-to-string-and-string-to.html
这篇关于如何图像转换成位平面在android系统?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文