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. 如何從可繪製文件夾獲取資源 - AndEngine
- 2. 帶數字的Android可繪製資源
- 3. 從C#中的資源文件獲取文件字節數
- 4. 如何從資源中獲取數組中的文本?
- 5. 添加可繪製資源
- 6. 可繪製資源的ID
- 7. 的Eclipse:從繪製資源
- 8. 如何從字節數組([UInt8])獲取一個字節(UInt8)?
- 9. android,如何從位圖獲取資源標識符/在內存中繪製?
- 10. 如何從資源中獲取視圖?
- 11. 如何從資源中獲取文件
- 12. Android:帶數字的可繪製資源。可能嗎?
- 13. android中的可繪製資源管理
- 14. C#在資源中存儲二進制流(或字節數組)
- 15. 如何從可繪製資源創建ImageView動畫序列?
- 16. 如何從TomEE 7中的資源獲取數據源?
- 17. 將資源聲音文件讀取到字節數組中
- 18. 如何獲取字節數組的TypeCode?
- 19. 從資源ID獲取可繪製對象時的相同圖像
- 20. 如何在swift 3中從base64獲取一個字節數組?
- 21. 如何從PDF生成的PDF中獲取字節數組?
- 22. 如何從Spring WebClient的ClientResponse中獲取最佳字節數組?
- 23. 從字節數組中獲取最後一個字節
- 24. 如何從c中的字節數組讀取字節範圍
- 25. 獲取從位圖的字節數組
- 26. 從字節數組獲取文件名
- 27. 從ByteArrayInputStream獲取內部字節數組
- 28. 如何使用CFNetwork從套接字獲取字節數組?
- 29. 如何從JarPackageFragmentRoot獲取資源?
- 30. 如何從POM獲取資源值
我相信你可以在http://stackoverflow.com/questions/6602417/get-the-uri-of-an-image-stored-in-drawable/36062748#36062748使用的解決方案 – 2016-08-20 20:29:27