H5 - - - - - Get image exif related information

1. What is EXIF

[Exchangeable image file format] : (English: Exchangeable image file format, officially referred to as Exif), is specially set for photos taken by digital cameras, and can record the attribute information and shooting data of digital photos.

2. EXIF ​​related logos

{
    
    
ApertureValue: "2.2750071245369052",//光圈值
Artist:"作者",
BrightnessValue: "8.631048387096774",//明度值
ColorSpace: "1",//色彩空间
ComponentsConfiguration: "YCbCr",//光栅(似乎是和"RGB"类似的东西)
DateTime: "2015:05:27 08:30:38",//拍摄时间
DateTimeDigitized: "2015:05:27 08:30:38",//拍摄时间(电子)
DateTimeOriginal: "2015:05:27 08:30:38",//拍摄时间(原始)
ExifIFDPointer: "208",//
ExifVersion: "0221",//exif版本
ExposureBias: "0",//曝光偏差
ExposureMode: "0",//曝光模式
ExposureProgram: "Normal program",//曝光程序
ExposureTime: "0.0024271844660194173",//曝光时间
FNumber: "2.2",//光圈(F值)
Flash: "Flash did not fire, compulsory flash mode",//记录闪光灯状态
FlashpixVersion: "0100",//FlashPix版本
FocalLength: "4.15",//镜头焦距
FocalLengthIn35mmFilm: "29",//35毫米胶片焦距
GPSAltitude: "33.97305389221557",//GPS海拔,米
GPSAltitudeRef: "0",//海拔参照:上面的海拔在海面上,则为0,如果是海面下,则为1
GPSDateStamp: "2015:05:27",//GPS日期(原子钟)
GPSDestBearing: "273.2704918032787",//目标方位
GPSDestBearingRef: "T",//目标方位参照
GPSImgDirection: "93.27047619047619",//图像方位
GPSImgDirectionRef: "T",//图像方位参照
GPSInfoIFDPointer: "1658",//
GPSLatitude: "22,35,6.07",//纬度
GPSLatitudeRef: "N",//纬度参考
GPSLongitude: "113,55,57.42",//经度
GPSLongitudeRef: "E",//经度参考
GPSSpeed: "0",//GPS接收器速度
GPSSpeedRef: "K",//GPS接收器速度单位
GPSTimeStamp: "0,30,37.88",//GPS时间(原子钟)
ImageDescription:'',//图像描述
LensMake: "Apple",//    镜头生产商
LensModel: "iPhone 6 Plus back camera 4.15mm f/2.2",//镜头型号
LensSpecification: "4.15,4.15,2.2,2.2",//镜头规格
Make: "Apple",//相机生产厂家
MakerNote: "",//制造商的内部数据. 一些制造商如 Olympus/Nikon/Sanyo 等在这个区域中使用IFD 格式的数据.
MeteringMode: "Pattern",//曝光的测光方法. '0' 表示未知, '1' 为平均测光, '2' 为中央重点测光, '3' 是点测光, '4' 是多点测光, '5' 是多区域测光, '6' 部分测光, '255' 则是其他.
Model: "iPhone 6 Plus",//相机型号
Orientation: "right-top",//方向
PhotographicSensitivity: "32",//感光度
PixelXDimension: "3264",//有效图像宽
PixelYDimension: "2448",//有效图像高
ResolutionUnit: "2",//XResolution(0x011a)/YResolution(0x011b)的单位. '1' 表示没有单位, '2' 意味着英寸, '3' 表示厘米. 缺省值是 '2'(英寸).
SceneCaptureType: "Standard",//场景拍摄类型
SceneType: "Directly photographed",//表示拍摄场景的类型. 值 '0x01' 表示图像是通过相机直接拍摄出来的.(与上面好像是一样的描述,因为两个是不同文档里摘抄过来的)
SensingMethod: "One-chip color area sensor",//表示图像传感器单元的类型. '2' 意味着这是一个芯片颜色区域传感器, 几乎所有的数字相机都 使用这个类型.
ShutterSpeedValue: "8.686015831134565",//用APEX表示出的快门速度. 为了转换成原始的 'Shutter Speed'; 则先要计算2的ShutterSpeedValue次幂, 然后求倒数. 例如, 如果 ShutterSpeedValue 是 '4', 快门速度则是1/(24)=1/16秒.
Software: "8.1.2",//显示固件的版本号(数字相机的内部控制软件).
SubsecTime:"081",//同下
SubSecTimeDigitized: "081",//一些数字相机每秒能拍摄 2~30 张照片, 但是DateTime/DateTimeOriginal/DateTimeDigitized 标签只能记录到秒单位的时间. SubsecTime 标签就是用来记录秒后面的数据(微秒).例如, DateTimeOriginal = "1996:09:01 09:15:30", SubSecTimeOriginal = "130", 合并起来的原始的拍摄 时间就是 "1996:09:01 09:15:30.130"
SubSecTimeOriginal: "081",//同上
SubjectArea: "1631,1223,1795,1077",//主体区域
WhiteBalance: "Auto white balance",//白平衡"AUTO", "WHITE PRESET" etc
XResolution: "72",//水平方向分辨率
YCbCrPositioning: "1",//当图像的格式是 YCbCr 并且使用 '子采样/Subsampling'(色度数据的剪切值, 所有的数字相机都使用), 定义了subsampling 像素阵列的色度采样点. '1'表示像素阵列的中心, '2' 表示基准点.
YResolution: "72"//垂直方向分辨率
}

3. How to obtain exif information on the front end

It is recommended to use [exif-js plug-in] .

  • Plug-in installation
    npm install exif-js --save
  • Page usage
import EXIF from 'exif-js';

function uploadFile(){
    
    
   let file = document.getElementById("upload").files[0];
   EXIF.getData(file, function () {
    
    
       console.log("getData", this);
       // 这里面可以看到值,想要什么直接获取即可。
       console.log("所有exif的信息", EXIF.getAllTags(this));
     });
}

The effect is as follows:
Insert image description here

Guess you like

Origin blog.csdn.net/Dark_programmer/article/details/135408834