Android读取图片当中的信息exif
2016-02-26 17:11
441 查看
在Android当中读取图片当中的信息,利用exifinterface类。
实例:
实例:
try { ExifInterface exif = new ExifInterface("/data/1111.jpg");
//照片拍摄的时间
String time = exif.getAttribute(ExifInterface.TAG_DATETIME); //什么设备拍的照片 //String modl = exif.getAttribute(ExifInterface.TAG_MODEL); System.out.println(time);
<span style="color:#000000;font: 14px/26px Arial; text-align: left; text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;">二、图片的MIMEExif信息 </span><span style="color:#000000;font: 14px/26px Arial; text-align: left; text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;"></span><p style="font: 14px/26px Arial; margin: 0px; padding: 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;"><span style="font-size:14px;"> 图片的的Exif信息和MP3的ID3标签类似,使用了属性和值的存储方式。通过publicvoidsetAttribute(Stringtag,Stringvalue)来设</span></p><p style="font: 14px/26px Arial; margin: 0px; padding: 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;"><span style="font-size:14px;">置,而获取可以通过publicintgetAttributeInt(Stringtag,intdefaultValue)和publicStringgetAttribute(Stringtag)两种方法都可以,</span></p><p style="font: 14px/26px Arial; margin: 0px; padding: 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;"><span style="font-size:14px;">getAttributeInt重载方法一第二个参数为我们设置的默认值,如果成功则返回相应Tag的值;特定的整数内容为该方法直接返回值。而</span></p><p style="font: 14px/26px Arial; margin: 0px; padding: 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;"><span style="font-size:14px;">重载方法二该方法直接返回结果,如果失败则为null。</span></p><span style="color:#000000;font: 14px/26px Arial; text-align: left; text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;"> 目前AndroidSDK定义的Tag有: TAG_DATETIME时间日期 TAG_FLASH闪光灯 TAG_GPS_LATITUDE纬度 TAG_GPS_LATITUDE_REF纬度参考 TAG_GPS_LONGITUDE经度 TAG_GPS_LONGITUDE_REF经度参考 TAG_IMAGE_LENGTH图片长 TAG_IMAGE_WIDTH图片宽 TAG_MAKE设备制造商 TAG_MODEL设备型号 TAG_ORIENTATION方向 TAG_WHITE_BALANCE白平衡 </span><span style="color:#000000;font: 14px/26px Arial; text-align: left; text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; float: none; display: inline !important; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;"></span><p style="font: 14px/26px Arial; margin: 0px; padding: 0px; text-align: left; color: rgb(0, 0, 0); text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;"><span style="font-size:14px;"> </span></p><span style="color:#000000;font: 14px/26px Arial; text-align: left; text-transform: none; text-indent: 0px; letter-spacing: normal; word-spacing: 0px; white-space: normal; font-size-adjust: none; font-stretch: normal; background-color: rgb(255, 255, 255); -webkit-text-stroke-width: 0px;"> </span>
相关文章推荐
- 我们为什么要用fitsSystemWindows?
- GitHub 优秀的 Android 开源项目
- 自定义控件View(三)___绘制饼状图
- android graphic(10)—activity申请surface流程
- 使用Android studio分析内存泄露
- Android代码混淆常用设置
- Android NDK开发
- Android Fragment 中自定义键盘如何调整布局,不挡住界面控件
- Android FLAG_ACTIVITY_CLEAR…
- JAVA_Android开发官网
- 解决 Android tex…
- Android异常汇总
- Android edittext&nbsp…
- android如何查看cpu的占用率和内存泄漏
- Android客户端调用优酷视频播放器…
- android 实现图片加水印
- android 根据资源名称获取资源ID的方法
- Android 浮动搜索框 searchable 使用(转)。
- android 四舍五入
- android achartengine&…