exifreader 4.5.1 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/exif-reader.js +1 -1
- package/dist/exif-reader.js.map +1 -1
- package/package.json +1 -1
- package/src/exif-reader.js +1 -1
- package/src/tag-names-0th-ifd.js +3 -15
- package/src/tag-names-common.js +175 -2
- package/src/tag-names-exif-ifd.js +18 -165
- package/src/xmp-tag-names.js +52 -1
- package/src/xmp-tags.js +5 -1
package/package.json
CHANGED
package/src/exif-reader.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ExifReader
|
|
3
3
|
* http://github.com/mattiasw/exifreader
|
|
4
|
-
* Copyright (C) 2011-
|
|
4
|
+
* Copyright (C) 2011-2022 Mattias Wallander <mattias@wallander.eu>
|
|
5
5
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
6
6
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
7
7
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
package/src/tag-names-0th-ifd.js
CHANGED
|
@@ -93,15 +93,11 @@ export default {
|
|
|
93
93
|
0x0119: 'MaxSampleValue',
|
|
94
94
|
0x011a: {
|
|
95
95
|
'name': 'XResolution',
|
|
96
|
-
'description':
|
|
97
|
-
return '' + Math.round(value[0] / value[1]);
|
|
98
|
-
}
|
|
96
|
+
'description': TagNamesCommon.XResolution
|
|
99
97
|
},
|
|
100
98
|
0x011b: {
|
|
101
99
|
'name': 'YResolution',
|
|
102
|
-
'description':
|
|
103
|
-
return '' + Math.round(value[0] / value[1]);
|
|
104
|
-
}
|
|
100
|
+
'description': TagNamesCommon.YResolution
|
|
105
101
|
},
|
|
106
102
|
0x011c: 'PlanarConfiguration',
|
|
107
103
|
0x011d: 'PageName',
|
|
@@ -129,15 +125,7 @@ export default {
|
|
|
129
125
|
},
|
|
130
126
|
0x0128: {
|
|
131
127
|
name: 'ResolutionUnit',
|
|
132
|
-
description:
|
|
133
|
-
if (value === 2) {
|
|
134
|
-
return 'inches';
|
|
135
|
-
}
|
|
136
|
-
if (value === 3) {
|
|
137
|
-
return 'centimeters';
|
|
138
|
-
}
|
|
139
|
-
return 'Unknown';
|
|
140
|
-
}
|
|
128
|
+
description: TagNamesCommon.ResolutionUnit
|
|
141
129
|
},
|
|
142
130
|
0x0129: 'PageNumber',
|
|
143
131
|
0x012d: 'TransferFunction',
|
package/src/tag-names-common.js
CHANGED
|
@@ -3,7 +3,104 @@
|
|
|
3
3
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
4
|
|
|
5
5
|
export default {
|
|
6
|
-
|
|
6
|
+
ApertureValue: (value) => Math.pow(Math.sqrt(2), value[0] / value[1]).toFixed(2),
|
|
7
|
+
ColorSpace(value) {
|
|
8
|
+
if (value === 1) {
|
|
9
|
+
return 'sRGB';
|
|
10
|
+
} else if (value === 0xffff) {
|
|
11
|
+
return 'Uncalibrated';
|
|
12
|
+
}
|
|
13
|
+
return 'Unknown';
|
|
14
|
+
},
|
|
15
|
+
ComponentsConfiguration(value) {
|
|
16
|
+
return value.map((character) => {
|
|
17
|
+
if (character === 0x31) {
|
|
18
|
+
return 'Y';
|
|
19
|
+
} else if (character === 0x32) {
|
|
20
|
+
return 'Cb';
|
|
21
|
+
} else if (character === 0x33) {
|
|
22
|
+
return 'Cr';
|
|
23
|
+
} else if (character === 0x34) {
|
|
24
|
+
return 'R';
|
|
25
|
+
} else if (character === 0x35) {
|
|
26
|
+
return 'G';
|
|
27
|
+
} else if (character === 0x36) {
|
|
28
|
+
return 'B';
|
|
29
|
+
}
|
|
30
|
+
}).join('');
|
|
31
|
+
},
|
|
32
|
+
Contrast(value) {
|
|
33
|
+
if (value === 0) {
|
|
34
|
+
return 'Normal';
|
|
35
|
+
} else if (value === 1) {
|
|
36
|
+
return 'Soft';
|
|
37
|
+
} else if (value === 2) {
|
|
38
|
+
return 'Hard';
|
|
39
|
+
}
|
|
40
|
+
return 'Unknown';
|
|
41
|
+
},
|
|
42
|
+
CustomRendered(value) {
|
|
43
|
+
if (value === 0) {
|
|
44
|
+
return 'Normal process';
|
|
45
|
+
} else if (value === 1) {
|
|
46
|
+
return 'Custom process';
|
|
47
|
+
}
|
|
48
|
+
return 'Unknown';
|
|
49
|
+
},
|
|
50
|
+
ExposureMode(value) {
|
|
51
|
+
if (value === 0) {
|
|
52
|
+
return 'Auto exposure';
|
|
53
|
+
} else if (value === 1) {
|
|
54
|
+
return 'Manual exposure';
|
|
55
|
+
} else if (value === 2) {
|
|
56
|
+
return 'Auto bracket';
|
|
57
|
+
}
|
|
58
|
+
return 'Unknown';
|
|
59
|
+
},
|
|
60
|
+
ExposureProgram(value) {
|
|
61
|
+
if (value === 0) {
|
|
62
|
+
return 'Undefined';
|
|
63
|
+
} else if (value === 1) {
|
|
64
|
+
return 'Manual';
|
|
65
|
+
} else if (value === 2) {
|
|
66
|
+
return 'Normal program';
|
|
67
|
+
} else if (value === 3) {
|
|
68
|
+
return 'Aperture priority';
|
|
69
|
+
} else if (value === 4) {
|
|
70
|
+
return 'Shutter priority';
|
|
71
|
+
} else if (value === 5) {
|
|
72
|
+
return 'Creative program';
|
|
73
|
+
} else if (value === 6) {
|
|
74
|
+
return 'Action program';
|
|
75
|
+
} else if (value === 7) {
|
|
76
|
+
return 'Portrait mode';
|
|
77
|
+
} else if (value === 8) {
|
|
78
|
+
return 'Landscape mode';
|
|
79
|
+
} else if (value === 9) {
|
|
80
|
+
return 'Bulb';
|
|
81
|
+
}
|
|
82
|
+
return 'Unknown';
|
|
83
|
+
},
|
|
84
|
+
ExposureTime(value) {
|
|
85
|
+
if (value[0] >= value[1]) {
|
|
86
|
+
return `${Math.round(value[0] / value[1])}`;
|
|
87
|
+
}
|
|
88
|
+
if (value[0] !== 0) {
|
|
89
|
+
return `1/${Math.round(value[1] / value[0])}`;
|
|
90
|
+
}
|
|
91
|
+
return `0/${value[1]}`;
|
|
92
|
+
},
|
|
93
|
+
FNumber: (value) => `f/${value[0] / value[1]}`,
|
|
94
|
+
FocalLength: (value) => (value[0] / value[1]) + ' mm',
|
|
95
|
+
FocalPlaneResolutionUnit(value) {
|
|
96
|
+
if (value === 2) {
|
|
97
|
+
return 'inches';
|
|
98
|
+
} else if (value === 3) {
|
|
99
|
+
return 'centimeters';
|
|
100
|
+
}
|
|
101
|
+
return 'Unknown';
|
|
102
|
+
},
|
|
103
|
+
LightSource: (value) => {
|
|
7
104
|
if (value === 1) {
|
|
8
105
|
return 'Daylight';
|
|
9
106
|
} else if (value === 2) {
|
|
@@ -46,5 +143,81 @@ export default {
|
|
|
46
143
|
return 'Other light source';
|
|
47
144
|
}
|
|
48
145
|
return 'Unknown';
|
|
49
|
-
}
|
|
146
|
+
},
|
|
147
|
+
MeteringMode(value) {
|
|
148
|
+
if (value === 1) {
|
|
149
|
+
return 'Average';
|
|
150
|
+
} else if (value === 2) {
|
|
151
|
+
return 'CenterWeightedAverage';
|
|
152
|
+
} else if (value === 3) {
|
|
153
|
+
return 'Spot';
|
|
154
|
+
} else if (value === 4) {
|
|
155
|
+
return 'MultiSpot';
|
|
156
|
+
} else if (value === 5) {
|
|
157
|
+
return 'Pattern';
|
|
158
|
+
} else if (value === 6) {
|
|
159
|
+
return 'Partial';
|
|
160
|
+
} else if (value === 255) {
|
|
161
|
+
return 'Other';
|
|
162
|
+
}
|
|
163
|
+
return 'Unknown';
|
|
164
|
+
},
|
|
165
|
+
ResolutionUnit(value) {
|
|
166
|
+
if (value === 2) {
|
|
167
|
+
return 'inches';
|
|
168
|
+
}
|
|
169
|
+
if (value === 3) {
|
|
170
|
+
return 'centimeters';
|
|
171
|
+
}
|
|
172
|
+
return 'Unknown';
|
|
173
|
+
},
|
|
174
|
+
Saturation(value) {
|
|
175
|
+
if (value === 0) {
|
|
176
|
+
return 'Normal';
|
|
177
|
+
} else if (value === 1) {
|
|
178
|
+
return 'Low saturation';
|
|
179
|
+
} else if (value === 2) {
|
|
180
|
+
return 'High saturation';
|
|
181
|
+
}
|
|
182
|
+
return 'Unknown';
|
|
183
|
+
},
|
|
184
|
+
SceneCaptureType(value) {
|
|
185
|
+
if (value === 0) {
|
|
186
|
+
return 'Standard';
|
|
187
|
+
} else if (value === 1) {
|
|
188
|
+
return 'Landscape';
|
|
189
|
+
} else if (value === 2) {
|
|
190
|
+
return 'Portrait';
|
|
191
|
+
} else if (value === 3) {
|
|
192
|
+
return 'Night scene';
|
|
193
|
+
}
|
|
194
|
+
return 'Unknown';
|
|
195
|
+
},
|
|
196
|
+
Sharpness(value) {
|
|
197
|
+
if (value === 0) {
|
|
198
|
+
return 'Normal';
|
|
199
|
+
} else if (value === 1) {
|
|
200
|
+
return 'Soft';
|
|
201
|
+
} else if (value === 2) {
|
|
202
|
+
return 'Hard';
|
|
203
|
+
}
|
|
204
|
+
return 'Unknown';
|
|
205
|
+
},
|
|
206
|
+
ShutterSpeedValue(value) {
|
|
207
|
+
const denominator = Math.pow(2, value[0] / value[1]);
|
|
208
|
+
if (denominator <= 1) {
|
|
209
|
+
return `${Math.round(1 / denominator)}`;
|
|
210
|
+
}
|
|
211
|
+
return `1/${Math.round(denominator)}`;
|
|
212
|
+
},
|
|
213
|
+
WhiteBalance(value) {
|
|
214
|
+
if (value === 0) {
|
|
215
|
+
return 'Auto white balance';
|
|
216
|
+
} else if (value === 1) {
|
|
217
|
+
return 'Manual white balance';
|
|
218
|
+
}
|
|
219
|
+
return 'Unknown';
|
|
220
|
+
},
|
|
221
|
+
XResolution: (value) => '' + Math.round(value[0] / value[1]),
|
|
222
|
+
YResolution: (value) => '' + Math.round(value[0] / value[1])
|
|
50
223
|
};
|
|
@@ -8,46 +8,15 @@ import TagNamesCommon from './tag-names-common.js';
|
|
|
8
8
|
export default {
|
|
9
9
|
0x829a: {
|
|
10
10
|
'name': 'ExposureTime',
|
|
11
|
-
'description':
|
|
12
|
-
if (value[0] >= value[1]) {
|
|
13
|
-
return `${Math.round(value[0] / value[1])}`;
|
|
14
|
-
}
|
|
15
|
-
if (value[0] !== 0) {
|
|
16
|
-
return `1/${Math.round(value[1] / value[0])}`;
|
|
17
|
-
}
|
|
18
|
-
return `0/${value[1]}`;
|
|
19
|
-
}
|
|
11
|
+
'description': TagNamesCommon.ExposureTime
|
|
20
12
|
},
|
|
21
13
|
0x829d: {
|
|
22
14
|
'name': 'FNumber',
|
|
23
|
-
'description':
|
|
15
|
+
'description': TagNamesCommon.FNumber
|
|
24
16
|
},
|
|
25
17
|
0x8822: {
|
|
26
18
|
'name': 'ExposureProgram',
|
|
27
|
-
'description':
|
|
28
|
-
if (value === 0) {
|
|
29
|
-
return 'Undefined';
|
|
30
|
-
} else if (value === 1) {
|
|
31
|
-
return 'Manual';
|
|
32
|
-
} else if (value === 2) {
|
|
33
|
-
return 'Normal program';
|
|
34
|
-
} else if (value === 3) {
|
|
35
|
-
return 'Aperture priority';
|
|
36
|
-
} else if (value === 4) {
|
|
37
|
-
return 'Shutter priority';
|
|
38
|
-
} else if (value === 5) {
|
|
39
|
-
return 'Creative program';
|
|
40
|
-
} else if (value === 6) {
|
|
41
|
-
return 'Action program';
|
|
42
|
-
} else if (value === 7) {
|
|
43
|
-
return 'Portrait mode';
|
|
44
|
-
} else if (value === 8) {
|
|
45
|
-
return 'Landscape mode';
|
|
46
|
-
} else if (value === 9) {
|
|
47
|
-
return 'Bulb';
|
|
48
|
-
}
|
|
49
|
-
return 'Unknown';
|
|
50
|
-
}
|
|
19
|
+
'description': TagNamesCommon.ExposureProgram
|
|
51
20
|
},
|
|
52
21
|
0x8824: 'SpectralSensitivity',
|
|
53
22
|
0x8827: 'ISOSpeedRatings',
|
|
@@ -86,40 +55,16 @@ export default {
|
|
|
86
55
|
0x9012: 'OffsetTimeDigitized',
|
|
87
56
|
0x9101: {
|
|
88
57
|
'name': 'ComponentsConfiguration',
|
|
89
|
-
'description':
|
|
90
|
-
return value.map((character) => {
|
|
91
|
-
if (character === 0x31) {
|
|
92
|
-
return 'Y';
|
|
93
|
-
} else if (character === 0x32) {
|
|
94
|
-
return 'Cb';
|
|
95
|
-
} else if (character === 0x33) {
|
|
96
|
-
return 'Cr';
|
|
97
|
-
} else if (character === 0x34) {
|
|
98
|
-
return 'R';
|
|
99
|
-
} else if (character === 0x35) {
|
|
100
|
-
return 'G';
|
|
101
|
-
} else if (character === 0x36) {
|
|
102
|
-
return 'B';
|
|
103
|
-
}
|
|
104
|
-
}).join('');
|
|
105
|
-
}
|
|
58
|
+
'description': TagNamesCommon.ComponentsConfiguration
|
|
106
59
|
},
|
|
107
60
|
0x9102: 'CompressedBitsPerPixel',
|
|
108
61
|
0x9201: {
|
|
109
62
|
'name': 'ShutterSpeedValue',
|
|
110
|
-
'description':
|
|
111
|
-
const denominator = Math.pow(2, value[0] / value[1]);
|
|
112
|
-
if (denominator <= 1) {
|
|
113
|
-
return `${Math.round(1 / denominator)}`;
|
|
114
|
-
}
|
|
115
|
-
return `1/${Math.round(denominator)}`;
|
|
116
|
-
}
|
|
63
|
+
'description': TagNamesCommon.ShutterSpeedValue
|
|
117
64
|
},
|
|
118
65
|
0x9202: {
|
|
119
66
|
'name': 'ApertureValue',
|
|
120
|
-
'description':
|
|
121
|
-
return Math.pow(Math.sqrt(2), value[0] / value[1]).toFixed(2);
|
|
122
|
-
}
|
|
67
|
+
'description': TagNamesCommon.ApertureValue
|
|
123
68
|
},
|
|
124
69
|
0x9203: 'BrightnessValue',
|
|
125
70
|
0x9204: 'ExposureBiasValue',
|
|
@@ -135,28 +80,11 @@ export default {
|
|
|
135
80
|
},
|
|
136
81
|
0x9207: {
|
|
137
82
|
'name': 'MeteringMode',
|
|
138
|
-
'description':
|
|
139
|
-
if (value === 1) {
|
|
140
|
-
return 'Average';
|
|
141
|
-
} else if (value === 2) {
|
|
142
|
-
return 'CenterWeightedAverage';
|
|
143
|
-
} else if (value === 3) {
|
|
144
|
-
return 'Spot';
|
|
145
|
-
} else if (value === 4) {
|
|
146
|
-
return 'MultiSpot';
|
|
147
|
-
} else if (value === 5) {
|
|
148
|
-
return 'Pattern';
|
|
149
|
-
} else if (value === 6) {
|
|
150
|
-
return 'Partial';
|
|
151
|
-
} else if (value === 255) {
|
|
152
|
-
return 'Other';
|
|
153
|
-
}
|
|
154
|
-
return 'Unknown';
|
|
155
|
-
}
|
|
83
|
+
'description': TagNamesCommon.MeteringMode
|
|
156
84
|
},
|
|
157
85
|
0x9208: {
|
|
158
86
|
'name': 'LightSource',
|
|
159
|
-
description: TagNamesCommon
|
|
87
|
+
description: TagNamesCommon.LightSource
|
|
160
88
|
},
|
|
161
89
|
0x9209: {
|
|
162
90
|
'name': 'Flash',
|
|
@@ -211,7 +139,7 @@ export default {
|
|
|
211
139
|
},
|
|
212
140
|
0x920a: {
|
|
213
141
|
'name': 'FocalLength',
|
|
214
|
-
'description':
|
|
142
|
+
'description': TagNamesCommon.FocalLength
|
|
215
143
|
},
|
|
216
144
|
0x9211: 'ImageNumber',
|
|
217
145
|
0x9212: {
|
|
@@ -279,14 +207,7 @@ export default {
|
|
|
279
207
|
},
|
|
280
208
|
0xa001: {
|
|
281
209
|
'name': 'ColorSpace',
|
|
282
|
-
'description':
|
|
283
|
-
if (value === 1) {
|
|
284
|
-
return 'sRGB';
|
|
285
|
-
} else if (value === 0xffff) {
|
|
286
|
-
return 'Uncalibrated';
|
|
287
|
-
}
|
|
288
|
-
return 'Unknown';
|
|
289
|
-
}
|
|
210
|
+
'description': TagNamesCommon.ColorSpace
|
|
290
211
|
},
|
|
291
212
|
0xa002: 'PixelXDimension',
|
|
292
213
|
0xa003: 'PixelYDimension',
|
|
@@ -301,14 +222,7 @@ export default {
|
|
|
301
222
|
0xa20f: 'FocalPlaneYResolution',
|
|
302
223
|
0xa210: {
|
|
303
224
|
'name': 'FocalPlaneResolutionUnit',
|
|
304
|
-
'description':
|
|
305
|
-
if (value === 2) {
|
|
306
|
-
return 'inches';
|
|
307
|
-
} else if (value === 3) {
|
|
308
|
-
return 'centimeters';
|
|
309
|
-
}
|
|
310
|
-
return 'Unknown';
|
|
311
|
-
}
|
|
225
|
+
'description': TagNamesCommon.FocalPlaneResolutionUnit
|
|
312
226
|
},
|
|
313
227
|
0xa214: {
|
|
314
228
|
'name': 'SubjectLocation',
|
|
@@ -360,38 +274,15 @@ export default {
|
|
|
360
274
|
},
|
|
361
275
|
0xa401: {
|
|
362
276
|
'name': 'CustomRendered',
|
|
363
|
-
'description':
|
|
364
|
-
if (value === 0) {
|
|
365
|
-
return 'Normal process';
|
|
366
|
-
} else if (value === 1) {
|
|
367
|
-
return 'Custom process';
|
|
368
|
-
}
|
|
369
|
-
return 'Unknown';
|
|
370
|
-
}
|
|
277
|
+
'description': TagNamesCommon.CustomRendered
|
|
371
278
|
},
|
|
372
279
|
0xa402: {
|
|
373
280
|
'name': 'ExposureMode',
|
|
374
|
-
'description':
|
|
375
|
-
if (value === 0) {
|
|
376
|
-
return 'Auto exposure';
|
|
377
|
-
} else if (value === 1) {
|
|
378
|
-
return 'Manual exposure';
|
|
379
|
-
} else if (value === 2) {
|
|
380
|
-
return 'Auto bracket';
|
|
381
|
-
}
|
|
382
|
-
return 'Unknown';
|
|
383
|
-
}
|
|
281
|
+
'description': TagNamesCommon.ExposureMode
|
|
384
282
|
},
|
|
385
283
|
0xa403: {
|
|
386
284
|
'name': 'WhiteBalance',
|
|
387
|
-
'description':
|
|
388
|
-
if (value === 0) {
|
|
389
|
-
return 'Auto white balance';
|
|
390
|
-
} else if (value === 1) {
|
|
391
|
-
return 'Manual white balance';
|
|
392
|
-
}
|
|
393
|
-
return 'Unknown';
|
|
394
|
-
}
|
|
285
|
+
'description': TagNamesCommon.WhiteBalance
|
|
395
286
|
},
|
|
396
287
|
0xa404: {
|
|
397
288
|
'name': 'DigitalZoomRatio',
|
|
@@ -413,18 +304,7 @@ export default {
|
|
|
413
304
|
},
|
|
414
305
|
0xa406: {
|
|
415
306
|
'name': 'SceneCaptureType',
|
|
416
|
-
'description':
|
|
417
|
-
if (value === 0) {
|
|
418
|
-
return 'Standard';
|
|
419
|
-
} else if (value === 1) {
|
|
420
|
-
return 'Landscape';
|
|
421
|
-
} else if (value === 2) {
|
|
422
|
-
return 'Portrait';
|
|
423
|
-
} else if (value === 3) {
|
|
424
|
-
return 'Night scene';
|
|
425
|
-
}
|
|
426
|
-
return 'Unknown';
|
|
427
|
-
}
|
|
307
|
+
'description': TagNamesCommon.SceneCaptureType
|
|
428
308
|
},
|
|
429
309
|
0xa407: {
|
|
430
310
|
'name': 'GainControl',
|
|
@@ -445,42 +325,15 @@ export default {
|
|
|
445
325
|
},
|
|
446
326
|
0xa408: {
|
|
447
327
|
'name': 'Contrast',
|
|
448
|
-
'description':
|
|
449
|
-
if (value === 0) {
|
|
450
|
-
return 'Normal';
|
|
451
|
-
} else if (value === 1) {
|
|
452
|
-
return 'Soft';
|
|
453
|
-
} else if (value === 2) {
|
|
454
|
-
return 'Hard';
|
|
455
|
-
}
|
|
456
|
-
return 'Unknown';
|
|
457
|
-
}
|
|
328
|
+
'description': TagNamesCommon.Contrast
|
|
458
329
|
},
|
|
459
330
|
0xa409: {
|
|
460
331
|
'name': 'Saturation',
|
|
461
|
-
'description':
|
|
462
|
-
if (value === 0) {
|
|
463
|
-
return 'Normal';
|
|
464
|
-
} else if (value === 1) {
|
|
465
|
-
return 'Low saturation';
|
|
466
|
-
} else if (value === 2) {
|
|
467
|
-
return 'High saturation';
|
|
468
|
-
}
|
|
469
|
-
return 'Unknown';
|
|
470
|
-
}
|
|
332
|
+
'description': TagNamesCommon.Saturation
|
|
471
333
|
},
|
|
472
334
|
0xa40a: {
|
|
473
335
|
'name': 'Sharpness',
|
|
474
|
-
'description':
|
|
475
|
-
if (value === 0) {
|
|
476
|
-
return 'Normal';
|
|
477
|
-
} else if (value === 1) {
|
|
478
|
-
return 'Soft';
|
|
479
|
-
} else if (value === 2) {
|
|
480
|
-
return 'Hard';
|
|
481
|
-
}
|
|
482
|
-
return 'Unknown';
|
|
483
|
-
}
|
|
336
|
+
'description': TagNamesCommon.Sharpness
|
|
484
337
|
},
|
|
485
338
|
0xa40b: {
|
|
486
339
|
'name': 'DeviceSettingDescription',
|
package/src/xmp-tag-names.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
3
3
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
4
|
|
|
5
|
+
import TagNamesCommon from './tag-names-common.js';
|
|
6
|
+
|
|
5
7
|
export default {
|
|
6
8
|
'tiff:Orientation'(value) {
|
|
7
9
|
if (value === '1') {
|
|
@@ -30,10 +32,59 @@ export default {
|
|
|
30
32
|
}
|
|
31
33
|
return value;
|
|
32
34
|
},
|
|
35
|
+
'tiff:ResolutionUnit': (value) => TagNamesCommon.ResolutionUnit(parseInt(value, 10)),
|
|
36
|
+
'tiff:XResolution': (value) => fraction(TagNamesCommon.XResolution, value),
|
|
37
|
+
'tiff:YResolution': (value) => fraction(TagNamesCommon.YResolution, value),
|
|
38
|
+
'exif:ApertureValue': (value) => fraction(TagNamesCommon.ApertureValue, value),
|
|
33
39
|
'exif:GPSLatitude': calculateGPSValue,
|
|
34
|
-
'exif:GPSLongitude': calculateGPSValue
|
|
40
|
+
'exif:GPSLongitude': calculateGPSValue,
|
|
41
|
+
'exif:FNumber': (value) => fraction(TagNamesCommon.FNumber, value),
|
|
42
|
+
'exif:FocalLength': (value) => fraction(TagNamesCommon.FocalLength, value),
|
|
43
|
+
'exif:FocalPlaneResolutionUnit': (value) => TagNamesCommon.FocalPlaneResolutionUnit(parseInt(value, 10)),
|
|
44
|
+
'exif:ColorSpace': (value) => TagNamesCommon.ColorSpace(parseNumber(value)),
|
|
45
|
+
'exif:ComponentsConfiguration'(value, description) {
|
|
46
|
+
if (/^\d, \d, \d, \d$/.test(description)) {
|
|
47
|
+
const numbers = description.split(', ').map((number) => number.charCodeAt(0));
|
|
48
|
+
return TagNamesCommon.ComponentsConfiguration(numbers);
|
|
49
|
+
}
|
|
50
|
+
return description;
|
|
51
|
+
},
|
|
52
|
+
'exif:Contrast': (value) => TagNamesCommon.Contrast(parseInt(value, 10)),
|
|
53
|
+
'exif:CustomRendered': (value) => TagNamesCommon.CustomRendered(parseInt(value, 10)),
|
|
54
|
+
'exif:ExposureMode': (value) => TagNamesCommon.ExposureMode(parseInt(value, 10)),
|
|
55
|
+
'exif:ExposureProgram': (value) => TagNamesCommon.ExposureProgram(parseInt(value, 10)),
|
|
56
|
+
'exif:ExposureTime'(value) {
|
|
57
|
+
if (isFraction(value)) {
|
|
58
|
+
return TagNamesCommon.ExposureTime(value.split('/').map((number) => parseInt(number, 10)));
|
|
59
|
+
}
|
|
60
|
+
return value;
|
|
61
|
+
},
|
|
62
|
+
'exif:MeteringMode': (value) => TagNamesCommon.MeteringMode(parseInt(value, 10)),
|
|
63
|
+
'exif:Saturation': (value) => TagNamesCommon.Saturation(parseInt(value, 10)),
|
|
64
|
+
'exif:SceneCaptureType': (value) => TagNamesCommon.SceneCaptureType(parseInt(value, 10)),
|
|
65
|
+
'exif:Sharpness': (value) => TagNamesCommon.Sharpness(parseInt(value, 10)),
|
|
66
|
+
'exif:ShutterSpeedValue': (value) => fraction(TagNamesCommon.ShutterSpeedValue, value),
|
|
67
|
+
'exif:WhiteBalance': (value) => TagNamesCommon.WhiteBalance(parseInt(value, 10))
|
|
35
68
|
};
|
|
36
69
|
|
|
70
|
+
function fraction(func, value) {
|
|
71
|
+
if (isFraction(value)) {
|
|
72
|
+
return func(value.split('/'));
|
|
73
|
+
}
|
|
74
|
+
return value;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function parseNumber(value) {
|
|
78
|
+
if (value.substring(0, 2) === '0x') {
|
|
79
|
+
return parseInt(value.substring(2), 16);
|
|
80
|
+
}
|
|
81
|
+
return parseInt(value, 10);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function isFraction(value) {
|
|
85
|
+
return /^-?\d+\/-?\d+$/.test(value);
|
|
86
|
+
}
|
|
87
|
+
|
|
37
88
|
function calculateGPSValue(value) {
|
|
38
89
|
const [degreesString, minutesString] = value.split(',');
|
|
39
90
|
if ((degreesString !== undefined) && (minutesString !== undefined)) {
|
package/src/xmp-tags.js
CHANGED
|
@@ -229,7 +229,11 @@ function getLocalName(name) {
|
|
|
229
229
|
|
|
230
230
|
function getDescription(value, name = undefined) {
|
|
231
231
|
if (Array.isArray(value)) {
|
|
232
|
-
|
|
232
|
+
const arrayDescription = getDescriptionOfArray(value);
|
|
233
|
+
if ((name) && (typeof XmpTagNames[name] === 'function')) {
|
|
234
|
+
return XmpTagNames[name](value, arrayDescription);
|
|
235
|
+
}
|
|
236
|
+
return arrayDescription;
|
|
233
237
|
}
|
|
234
238
|
if (typeof value === 'object') {
|
|
235
239
|
return getDescriptionOfObject(value);
|