获取照片的Exif信息

来源:互联网 发布:青岛知豆电动车租赁 编辑:程序博客网 时间:2024/05/01 17:34

EXIFExchangeable image file format)是可交换图像文件的缩写,是专门为数码相机的照片设定的,可以记录数码照片的属性信息和拍摄数据。

一般而言包括以下一些信息:
Image Description 图像描述、来源,指生成图像的工具
Artist 作者 有些相机可以输入使用者的名字
Make 生产者 指产品生产厂家
Model 型号 指设备型号
Orientation 方向 有的相机支持,有的不支持
XResolution/YResolution X/Y方向分辨率 本栏目已有专门条目解释此问题。
Resolution Unit 分辨率单位 一般为PPI
Software 软件 显示固件Firmware版本
Date Time 日期和时间
YCbCrPositioning 色相定位
Exif Offset Exif 信息位置 定义Exif在信息在文件中的写入,有些软件不显示
Exposure Time 曝光时间 即快门速度
F Number光圈系数
Exposure Program 曝光程序 指程序式自动曝光的设置,各相机不同,可能是Shutter Priority(快门优先,Tv)、Aperture Priority(快门优先,Av)等等。
ISO speed ratings感光度
Exif Version Exif版本
DateTime Original 创建时间
DateTime Digitized 数字化时间
Components Configuration 图像构造(多指色彩组合方案)
Compressed Bits per Pixel(BPP) 压缩时每像素色彩位 指压缩程度
Exposure Bias Value 曝光补偿。
Max Aperture Value 最大光圈
Metering Mode 测光方式、平均式测光、中央重点测光、点测光等。
Light source 光源 指白平衡设置
Flash 是否使用闪光灯。
Focal Length 焦距,一般显示镜头物理焦距,有些软件可以定义一个系数,从而显示相当于35mm相机的焦距
Maker Note (User Comment) 作者标记、说明、记录
Flash Pix Version Flash Pix 版本(个别机型支持)
Color Space 色域、色彩空间
ExifImage Width (Pixel X Dimension) 图像宽度 指横向像素数
ExifImage Length (Pixel Y Dimension) 图像高度 指纵向像素数
Interoperability IFD 通用性扩展项定义指针 和TIFF文件相关,具体含义不详
File Source 源文件
Compression 压缩比
package douban.day05.exif;import java.io.IOException;import android.app.Activity;import android.media.ExifInterface;import android.os.Bundle;public class ExifActivity extends Activity {/** Called when the activity is first created. */@Overridepublic void onCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState);setContentView(R.layout.main);try {ExifInterface ex = new ExifInterface("/sdcard/img.JPG");// 获取图片的拍摄时间信息String time = ex.getAttribute(ExifInterface.TAG_DATETIME);System.out.println( "图片拍摄时间"+time);//设置图片的信息ex.setAttribute("camera", "尼康-d700");String camera = ex.getAttribute("camera");System.out.println("相机类型"+camera);} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}



原创粉丝点击