当我从相机(从设备主屏幕)捕获图像并检查 SD 卡上的图像大小时,它显示在 300-500 Kb 之间。
但是当我使用相机意图在我的应用程序中捕获图像并将其保存在 SD 卡上(在新文件夹中)时,它显示的图像大小在 5-10 Kb 之间。
这是我在 onActivityResult 中拍照后用来将图像保存在 SD 卡上的代码:
Bitmap bit = (Bitmap) data.getExtras().get("data");
ByteArrayOutputStream bao = new ByteArrayOutputStream();
bit.compress(Bitmap.CompressFormat.JPEG, 100, bao);
byte[] ba = bao.toByteArray();
File imagesFolder = new File(Environment.getExternalStorageDirectory(), "My - Images");
File f = new File(imagesFolder, "test.jpg");
f.createNewFile();
FileOutputStream fo = new FileOutputStream(f);
fo.write(ba);
fo.flush();
fo.close();
如何将其保存为原始大小的图像(300-500 Kb)?
有没有办法在我将图像保存到 SD 卡之前获取图像大小?
谢谢你