-1
A
回答
1
試試這個:
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.mysamplecode.com/2011/07/convert-image-to-string-and-string-to.html
相關問題
- 1. 我們如何將FaceDetector.Face轉換爲android中的位圖圖像?
- 2. 將圖像轉換爲位圖android
- 3. 如何將圖像轉換爲位圖
- 4. 如何將位圖轉換爲圖像
- 5. 如何將PDF頁面轉換爲Android中的位圖?
- 6. 如何將PDF頁面轉換爲Android中的圖像?
- 7. 如何將位圖圖像轉換爲android中的二進制圖像?
- 8. 如何將圖像轉換爲android中的文本轉換器?
- 9. Android:將位圖轉換爲單色位圖(每像素1位)
- 10. android將位圖轉換爲ascii位圖
- 11. 如何將24位圖像轉換爲16位rgb565位圖?
- 12. 將byteArray轉換爲android中的位圖?
- 13. 在Android中將視圖轉換爲位圖圖像
- 14. 如何將byteArray轉換爲位圖圖像以在Android中的imageview中顯示?
- 15. 如何將位圖圖像轉換爲Windows Phone 7中的png?
- 16. 如何將pdf轉換爲.net中的位圖圖像?
- 17. 如何將位圖圖像轉換爲CIELab圖像?
- 18. 我如何將位圖圖像轉換爲emgu圖像?
- 19. 將圖像URL轉換爲圖像Android
- 20. iOS - 如何將png圖像轉換爲4位位圖灰度?
- 21. 在Android中將位圖轉換爲GrayScale
- 22. 在android中將位圖轉換爲jpeg
- 23. C# - 如何將圖像轉換爲8位彩色圖像?
- 24. 將字節轉換爲位圖圖像
- 25. 將位圖轉換爲javascript圖像
- 26. 將PictureBox圖像轉換爲位圖
- 27. 將圖像轉換爲位圖
- 28. 將位圖轉換爲圖像
- 29. 將位圖轉換爲WebP圖像?
- 30. 將圖像轉換爲位圖
你是什麼意思與 「位面」?你試過什麼了? –