0
我正在使用相機意圖拍照,然後將該圖像轉換爲bytearray並最終將其保存到本地數據庫中。使用相機拍攝的原始圖像具有GPS緯度和經度等所有元數據。但是,從該圖像創建的位圖不包含任何元數據。我怎樣才能將原始的metedata添加到我的圖像?將元數據添加到Android中創建的位圖
這裏是我的代碼在相機意圖返回:
picUri = data.getData()
Bitmap yourSelectedImage62 = null;
String imagebytes2 ;
try
{
yourSelectedImage62 = MediaStore.Images.Media.getBitmap(this.getContentResolver(), picUri);
yourSelectedImage62 = Bitmap.createScaledBitmap(yourSelectedImage62, large_width, large_height, true);
} catch (FileNotFoundException ex)
{
Logger.getLogger(Screen_View_Submission.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(Screen_New_Submission.class.getName()).log(Level.SEVERE, null, ex);
}
ByteArrayOutputStream bao62 = new ByteArrayOutputStream();
yourSelectedImage62.compress(Bitmap.CompressFormat.JPEG, 75, bao62);
byte[] ba62 = bao62.toByteArray();
imagebytes2 = Base64.encodeToString(ba62,Base64.DEFAULT);
yourSelectedImage62.recycle();
謝謝,我會試試看。 – Janpan