4
A
回答
5
Get a bitmapdecodeResource(android.content.res.Resources, int)
然後決定將其壓縮到ByteArrayOutputStream()或copyPixelsToBuffer,並從緩衝區的數組。 http://developer.android.com/reference/android/graphics/Bitmap.html
2
ByteArrayOutputStream stream = new ByteArrayOutputStream();
mPhoto.compress(Bitmap.CompressFormat.JPEG /* FileType */,
100 /* Ratio */, stream);
HTH!
9
Drawable drawable;
Bitmap bitmap = ((BitmapDrawable) drawable).getBitmap();
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, stream);
byte[] bitmapdata = stream.toByteArray();
相關問題
- 1. 獲取ID可繪製資源數組
- 2. 獲取可繪製資源
- 3. 如何從可繪製文件夾獲取資源 - AndEngine
- 4. 如何獲取資源在c#中的字節數組?
- 5. 帶數字的Android可繪製資源
- 6. 從DefaultHandler內部獲取可繪製資源
- 7. 如何從字節數組中獲取字節並獲取數字
- 8. 如何從PictureBox獲取字節數組?
- 9. 如何從JTextArea獲取字節數組?
- 10. 從C#中的資源文件獲取文件字節數
- 11. 如何從資源文件中獲取數組的數量?
- 12. 如何從資源中獲取數組中的文本?
- 13. 添加可繪製資源
- 14. 可繪製資源的ID
- 15. 縮放可繪製資源
- 16. 可繪製的資源ID
- 17. 從C#資源獲取位圖數組
- 18. 如何從字節數組中讀取繪圖圖像(.dwg)
- 19. 的Eclipse:從繪製資源
- 20. 從imageview可繪製到字節數組(數據庫)
- 21. 如何從字節數組([UInt8])獲取一個字節(UInt8)?
- 22. android,如何從位圖獲取資源標識符/在內存中繪製?
- 23. 如何從類庫中獲取資源
- 24. 如何從資源中獲取文件
- 25. 如何從資源中獲取視圖?
- 26. Android獲取資源可繪製在圖書館項目
- 27. Android:帶數字的可繪製資源。可能嗎?
- 28. android中的可繪製資源管理
- 29. C#在資源中存儲二進制流(或字節數組)
- 30. 如何從可繪製資源創建ImageView動畫序列?
我相信你可以在http://stackoverflow.com/questions/6602417/get-the-uri-of-an-image-stored-in-drawable/36062748#36062748使用的解決方案 – 2016-08-20 20:29:27