0
我想將圖像從我的SD卡保存到Android設備庫中。問題是,圖像是保存爲JPEG而不是PNG,並且它損失了質量,看起來非常糟糕。如何將SD卡中的圖像保存爲png的Android圖庫?
這是我的代碼:
File sdCard = Environment.getExternalStorageDirectory();
File file = new File(sdCard, "fileName.png");
Bitmap top = BitmapFactory.decodeFile(file.getPath());
MediaStore.Images.Media.insertImage(getContentResolver(), top, "someText" , "someDescription");
Toast toast = Toast.makeText(getBaseContext(), "Image saved to gallery", Toast.LENGTH_SHORT);
toast.show();
爲什麼圖像保存爲JPEG,我怎麼能保存它沒有鬆動的質量? b.t.w - SD卡上的圖像質量非常好,如果我將圖像添加到意圖並通過電子郵件發送 - 質量非常好。