Android讀取圖片信息

通過ExifInterface類進(jìn)行操作

new ExifInterface(filename);//文件全路徑名

通過這個(gè)方法getAttribute,傳入對應(yīng)的TAG就可以獲取對應(yīng)的信息

直接代碼吧,打字真他么累^_^

String TAG_APERTURE =exifInterface.getAttribute(ExifInterface.TAG_APERTURE);

String TAG_DATETIME =exifInterface.getAttribute(ExifInterface.TAG_DATETIME);

String TAG_EXPOSURE_TIME =exifInterface.getAttribute(ExifInterface.TAG_EXPOSURE_TIME);

String TAG_FLASH =exifInterface.getAttribute(ExifInterface.TAG_FLASH);

String TAG_FOCAL_LENGTH =exifInterface.getAttribute(ExifInterface.TAG_FOCAL_LENGTH);

String TAG_IMAGE_LENGTH =exifInterface.getAttribute(ExifInterface.TAG_IMAGE_LENGTH);

String TAG_IMAGE_WIDTH =exifInterface.getAttribute(ExifInterface.TAG_IMAGE_WIDTH);

String TAG_ISO =exifInterface.getAttribute(ExifInterface.TAG_ISO);

String TAG_MAKE =exifInterface.getAttribute(ExifInterface.TAG_MAKE);

String TAG_MODEL =exifInterface.getAttribute(ExifInterface.TAG_MODEL);

String TAG_ORIENTATION =exifInterface.getAttribute(ExifInterface.TAG_ORIENTATION);

String TAG_WHITE_BALANCE =exifInterface.getAttribute(ExifInterface.TAG_WHITE_BALANCE);

String latitude =exifInterface.getAttribute(ExifInterface.TAG_GPS_LATITUDE);

String latitude_ref =exifInterface.getAttribute(ExifInterface.TAG_GPS_LATITUDE_REF);

String longitude =exifInterface.getAttribute(ExifInterface.TAG_GPS_LONGITUDE);

String longitude_ref =exifInterface.getAttribute(ExifInterface.TAG_GPS_LONGITUDE_REF);

Log.i(TAG, "光圈值:" + TAG_APERTURE);

Log.i(TAG, "拍攝時(shí)間:" + TAG_DATETIME);

Log.i(TAG, "曝光時(shí)間:" + TAG_EXPOSURE_TIME);

Log.i(TAG, "閃光燈:" + TAG_FLASH);

Log.i(TAG, "焦距:" + TAG_FOCAL_LENGTH);

Log.i(TAG, "圖片高度:" + TAG_IMAGE_LENGTH);

Log.i(TAG, "圖片寬度:" + TAG_IMAGE_WIDTH);

Log.i(TAG, "ISO:" + TAG_ISO);

Log.i(TAG, "設(shè)備品牌:" + TAG_MAKE);

Log.i(TAG, "設(shè)備型號:" + TAG_MODEL);

Log.i(TAG, "旋轉(zhuǎn)角度:" + TAG_ORIENTATION);

Log.i(TAG, "白平衡:" + TAG_WHITE_BALANCE);

Log.i(TAG, "latitude:" + latitude);

Log.i(TAG, "latitude_ref:" + latitude_ref);? //N

Log.i(TAG, "longitude:" + longitude);

Log.i(TAG, "longitude_ref:" + longitude_ref);? //E

常用的也就是 拍攝時(shí)間,寬高,經(jīng)緯度,有的圖片可能沒有經(jīng)緯度信息,就看拍攝時(shí)是否開啟位置信息。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容