【发布时间】:2019-09-24 20:24:00
【问题描述】:
我正在编写一个程序,它从资源/drawable 中读取图像并刷新到外部存储。我的问题是不同的设备为同一个图像消耗不同的内存,但是我需要内存消耗保持不变。例如,设备 1 显示图像大小为 3MB,而设备 2 显示图像大小为 4MB。以下是我拥有的示例代码。 TIA
BitmapFactory.Options options = new BitmapFactory.Options();
//setting few options
//making sure that the getByteCount will always return the same value irrespective of the device
bm = BitmapFactory.decodeResource(res, R.drawable.image, options);
bm.compress(Bitmap.CompressFormat.JPEG, 100, outStream); //where outstream is where I need to store my image in the device filesystem
【问题讨论】:
标签: java android image file-handling