美文网首页
Android读取图片信息

Android读取图片信息

作者: 敲代码的小新 | 来源:发表于2017-12-10 00:14 被阅读55次

    通过ExifInterface类进行操作

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

    通过这个方法getAttribute,传入对应的TAG就可以获取对应的信息

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

    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, "拍摄时间:" + TAG_DATETIME);

    Log.i(TAG, "曝光时间:" + 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, "设备品牌:" + TAG_MAKE);

    Log.i(TAG, "设备型号:" + TAG_MODEL);

    Log.i(TAG, "旋转角度:" + 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

    常用的也就是 拍摄时间,宽高,经纬度,有的图片可能没有经纬度信息,就看拍摄时是否开启位置信息。

    相关文章

      网友评论

          本文标题:Android读取图片信息

          本文链接:https://www.haomeiwen.com/subject/rfkmixtx.html