exifreader 4.54.0 → 4.55.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.
Files changed (83) hide show
  1. package/README.md +398 -27
  2. package/bin/analyze.js +139 -9
  3. package/bin/build-pages.js +21 -35
  4. package/bin/cli.js +81 -13
  5. package/bin/generate-tag-modules.js +287 -0
  6. package/dist/exif-reader.js +1 -1
  7. package/dist/exif-reader.js.map +1 -1
  8. package/exif-reader.d.ts +213 -38
  9. package/package.json +71 -11
  10. package/src/composable/brand.js +10 -0
  11. package/src/composable/composition-tag-filter.js +97 -0
  12. package/src/composable/composition.js +195 -0
  13. package/src/composable/core.d.ts +148 -0
  14. package/src/composable/core.js +526 -0
  15. package/src/composable/exif-block-reader.js +197 -0
  16. package/src/composable/formats/avif.js +19 -0
  17. package/src/composable/formats/gif.js +28 -0
  18. package/src/composable/formats/heic.js +19 -0
  19. package/src/composable/formats/iso-bmff-file-reader.js +14 -0
  20. package/src/composable/formats/jpeg.js +55 -0
  21. package/src/composable/formats/jxl.js +30 -0
  22. package/src/composable/formats/png.js +187 -0
  23. package/src/composable/formats/tiff.js +18 -0
  24. package/src/composable/formats/webp.js +28 -0
  25. package/src/composable/formats/xml.js +18 -0
  26. package/src/composable/formats.d.ts +17 -0
  27. package/src/composable/formats.js +17 -0
  28. package/src/composable/group-helpers.js +129 -0
  29. package/src/composable/groups/canon.js +26 -0
  30. package/src/composable/groups/composite.js +43 -0
  31. package/src/composable/groups/exif.js +48 -0
  32. package/src/composable/groups/gps.js +75 -0
  33. package/src/composable/groups/icc.js +52 -0
  34. package/src/composable/groups/iptc.js +86 -0
  35. package/src/composable/groups/maker-notes.js +21 -0
  36. package/src/composable/groups/mpf.js +25 -0
  37. package/src/composable/groups/pentax.js +34 -0
  38. package/src/composable/groups/photoshop.js +18 -0
  39. package/src/composable/groups/thumbnail.js +131 -0
  40. package/src/composable/groups/xmp.js +118 -0
  41. package/src/composable/groups.d.ts +20 -0
  42. package/src/composable/groups.js +105 -0
  43. package/src/composable/iptc-block-reader.js +44 -0
  44. package/src/composable/read-view.js +165 -0
  45. package/src/composable/tag-binding-name.js +17 -0
  46. package/src/composable/tags/exif.d.ts +295 -0
  47. package/src/composable/tags/exif.js +396 -0
  48. package/src/composable/tags/iptc.d.ts +84 -0
  49. package/src/composable/tags/iptc.js +109 -0
  50. package/src/composable/value-budget.js +24 -0
  51. package/src/composite.js +2 -2
  52. package/src/decompression.js +60 -0
  53. package/src/engine.js +50 -106
  54. package/src/errors.js +8 -2
  55. package/src/exif-reader.d.ts +8 -0
  56. package/src/exif-reader.js +112 -763
  57. package/src/file-loaders.js +74 -1
  58. package/src/file-tags.js +9 -9
  59. package/src/image-header.js +13 -47
  60. package/src/iptc-tag-names-descriptions.js +334 -0
  61. package/src/iptc-tag-names.js +50 -306
  62. package/src/iptc-tags.js +41 -27
  63. package/src/jfif-tags.js +9 -9
  64. package/src/load-auto.js +2 -2
  65. package/src/loadview-pipeline.js +52 -192
  66. package/src/node-require.js +15 -2
  67. package/src/png-text-tags.js +5 -3
  68. package/src/tag-filter-config.js +24 -15
  69. package/src/tag-filter.js +15 -3
  70. package/src/tag-names-0th-ifd-descriptions.js +232 -0
  71. package/src/tag-names-0th-ifd.js +49 -173
  72. package/src/tag-names-common.js +263 -211
  73. package/src/tag-names-exif-ifd-descriptions.js +249 -0
  74. package/src/tag-names-exif-ifd.js +55 -187
  75. package/src/tag-names-gps-ifd-descriptions.js +156 -0
  76. package/src/tag-names-gps-ifd.js +39 -146
  77. package/src/tag-names-utils.js +28 -3
  78. package/src/tags-helpers.js +6 -2
  79. package/src/types.js +2 -0
  80. package/src/unsupported-format-error.js +21 -0
  81. package/src/utils.js +22 -85
  82. package/src/xmp-tag-names.js +42 -21
  83. package/webpack.config.js +1 -1
@@ -0,0 +1,249 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+
5
+ import {getTableDescription} from './tag-names-utils.js';
6
+
7
+ export function getOECFDescription() {
8
+ return '[Raw OECF table data]';
9
+ }
10
+
11
+ export function getSensitivityTypeDescription(value) {
12
+ return getTableDescription({
13
+ 1: 'Standard Output Sensitivity',
14
+ 2: 'Recommended Exposure Index',
15
+ 3: 'ISO Speed',
16
+ 4: 'Standard Output Sensitivity and Recommended Exposure Index',
17
+ 5: 'Standard Output Sensitivity and ISO Speed',
18
+ 6: 'Recommended Exposure Index and ISO Speed',
19
+ 7: 'Standard Output Sensitivity, Recommended Exposure Index and ISO Speed'
20
+ }, value);
21
+ }
22
+
23
+ export function getMaxApertureValueDescription(value) {
24
+ return Math.pow(Math.sqrt(2), value[0] / value[1]).toFixed(2);
25
+ }
26
+
27
+ export function getSubjectDistanceDescription(value) {
28
+ return (value[0] / value[1]) + ' m';
29
+ }
30
+
31
+ export function getFlashDescription(value) {
32
+ if (value === 0x00) {
33
+ return 'Flash did not fire';
34
+ } else if (value === 0x01) {
35
+ return 'Flash fired';
36
+ } else if (value === 0x05) {
37
+ return 'Strobe return light not detected';
38
+ } else if (value === 0x07) {
39
+ return 'Strobe return light detected';
40
+ } else if (value === 0x09) {
41
+ return 'Flash fired, compulsory flash mode';
42
+ } else if (value === 0x0d) {
43
+ return 'Flash fired, compulsory flash mode, return light not detected';
44
+ } else if (value === 0x0f) {
45
+ return 'Flash fired, compulsory flash mode, return light detected';
46
+ } else if (value === 0x10) {
47
+ return 'Flash did not fire, compulsory flash mode';
48
+ } else if (value === 0x18) {
49
+ return 'Flash did not fire, auto mode';
50
+ } else if (value === 0x19) {
51
+ return 'Flash fired, auto mode';
52
+ } else if (value === 0x1d) {
53
+ return 'Flash fired, auto mode, return light not detected';
54
+ } else if (value === 0x1f) {
55
+ return 'Flash fired, auto mode, return light detected';
56
+ } else if (value === 0x20) {
57
+ return 'No flash function';
58
+ } else if (value === 0x41) {
59
+ return 'Flash fired, red-eye reduction mode';
60
+ } else if (value === 0x45) {
61
+ return 'Flash fired, red-eye reduction mode, return light not detected';
62
+ } else if (value === 0x47) {
63
+ return 'Flash fired, red-eye reduction mode, return light detected';
64
+ } else if (value === 0x49) {
65
+ return 'Flash fired, compulsory flash mode, red-eye reduction mode';
66
+ } else if (value === 0x4d) {
67
+ return 'Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected';
68
+ } else if (value === 0x4f) {
69
+ return 'Flash fired, compulsory flash mode, red-eye reduction mode, return light detected';
70
+ } else if (value === 0x59) {
71
+ return 'Flash fired, auto mode, red-eye reduction mode';
72
+ } else if (value === 0x5d) {
73
+ return 'Flash fired, auto mode, return light not detected, red-eye reduction mode';
74
+ } else if (value === 0x5f) {
75
+ return 'Flash fired, auto mode, return light detected, red-eye reduction mode';
76
+ }
77
+ return 'Unknown';
78
+ }
79
+
80
+ export function getSecurityClassificationDescription(value) {
81
+ return getTableDescription({
82
+ 'C': 'Confidential',
83
+ 'R': 'Restricted',
84
+ 'S': 'Secret',
85
+ 'T': 'Top Secret',
86
+ 'U': 'Unclassified'
87
+ }, value);
88
+ }
89
+
90
+ export function getSubjectAreaDescription(value) {
91
+ if (value.length === 2) {
92
+ return `Location; X: ${value[0]}, Y: ${value[1]}`;
93
+ } else if (value.length === 3) {
94
+ return `Circle; X: ${value[0]}, Y: ${value[1]}, diameter: ${value[2]}`;
95
+ } else if (value.length === 4) {
96
+ return `Rectangle; X: ${value[0]}, Y: ${value[1]}, width: ${value[2]}, height: ${value[3]}`;
97
+ }
98
+ return 'Unknown';
99
+ }
100
+
101
+ export function getMakerNoteDescription() {
102
+ return '[Raw maker note data]';
103
+ }
104
+
105
+ export function getAmbientTemperatureDescription(value) {
106
+ return (value[0] / value[1]) + ' °C';
107
+ }
108
+
109
+ export function getHumidityDescription(value) {
110
+ return (value[0] / value[1]) + ' %';
111
+ }
112
+
113
+ export function getPressureDescription(value) {
114
+ return (value[0] / value[1]) + ' hPa';
115
+ }
116
+
117
+ export function getWaterDepthDescription(value) {
118
+ return (value[0] / value[1]) + ' m';
119
+ }
120
+
121
+ export function getAccelerationDescription(value) {
122
+ return (value[0] / value[1]) + ' mGal';
123
+ }
124
+
125
+ export function getCameraElevationAngleDescription(value) {
126
+ return (value[0] / value[1]) + ' °';
127
+ }
128
+
129
+ export function getSpatialFrequencyResponseDescription() {
130
+ return '[Raw SFR table data]';
131
+ }
132
+
133
+ export function getSubjectLocationDescription([x, y]) {
134
+ return `X: ${x}, Y: ${y}`;
135
+ }
136
+
137
+ export function getSensingMethodDescription(value) {
138
+ if (value === 1) {
139
+ return 'Undefined';
140
+ } else if (value === 2) {
141
+ return 'One-chip color area sensor';
142
+ } else if (value === 3) {
143
+ return 'Two-chip color area sensor';
144
+ } else if (value === 4) {
145
+ return 'Three-chip color area sensor';
146
+ } else if (value === 5) {
147
+ return 'Color sequential area sensor';
148
+ } else if (value === 7) {
149
+ return 'Trilinear sensor';
150
+ } else if (value === 8) {
151
+ return 'Color sequential linear sensor';
152
+ }
153
+ return 'Unknown';
154
+ }
155
+
156
+ export function getFileSourceDescription(value) {
157
+ if (value === 3) {
158
+ return 'DSC';
159
+ }
160
+ return 'Unknown';
161
+ }
162
+
163
+ export function getSceneTypeDescription(value) {
164
+ if (value === 1) {
165
+ return 'A directly photographed image';
166
+ }
167
+ return 'Unknown';
168
+ }
169
+
170
+ export function getCFAPatternDescription() {
171
+ return '[Raw CFA pattern table data]';
172
+ }
173
+
174
+ export function getDigitalZoomRatioDescription(value) {
175
+ if (value[0] === 0) {
176
+ return 'Digital zoom was not used';
177
+ }
178
+ return '' + (value[0] / value[1]);
179
+ }
180
+
181
+ export function getGainControlDescription(value) {
182
+ if (value === 0) {
183
+ return 'None';
184
+ } else if (value === 1) {
185
+ return 'Low gain up';
186
+ } else if (value === 2) {
187
+ return 'High gain up';
188
+ } else if (value === 3) {
189
+ return 'Low gain down';
190
+ } else if (value === 4) {
191
+ return 'High gain down';
192
+ }
193
+ return 'Unknown';
194
+ }
195
+
196
+ export function getDeviceSettingDescriptionDescription() {
197
+ return '[Raw device settings table data]';
198
+ }
199
+
200
+ export function getSubjectDistanceRangeDescription(value) {
201
+ if (value === 1) {
202
+ return 'Macro';
203
+ } else if (value === 2) {
204
+ return 'Close view';
205
+ } else if (value === 3) {
206
+ return 'Distant view';
207
+ }
208
+ return 'Unknown';
209
+ }
210
+
211
+ export function getLensSpecificationDescription(value) {
212
+ return `${getLensFocalLengths(value[0], value[1])} mm f/${getLensApertures(value[2], value[3])}`;
213
+ }
214
+
215
+ export function getCompositeImageDescription(value) {
216
+ return getTableDescription({
217
+ 1: 'Not a Composite Image',
218
+ 2: 'General Composite Image',
219
+ 3: 'Composite Image Captured While Shooting',
220
+ }, value);
221
+ }
222
+
223
+ function getLensFocalLengths(from, to) {
224
+ const focalLengthFrom = getRoundedRational(from);
225
+ const focalLengthTo = getRoundedRational(to);
226
+ if (focalLengthTo === 0 || focalLengthTo === focalLengthFrom) {
227
+ return `${focalLengthFrom}`;
228
+ }
229
+ return `${focalLengthFrom}-${focalLengthTo}`;
230
+ }
231
+
232
+ function getLensApertures(wide, long) {
233
+ const apertures = [wide, long].filter(isKnownRational).map(getRoundedRational);
234
+ if (apertures.length === 0) {
235
+ return '?';
236
+ }
237
+ if (apertures.length === 1 || apertures[1] === 0 || apertures[1] === apertures[0]) {
238
+ return `${apertures[0]}`;
239
+ }
240
+ return `${apertures[0]}-${apertures[1]}`;
241
+ }
242
+
243
+ function getRoundedRational(rational) {
244
+ return parseFloat((rational[0] / rational[1]).toFixed(5));
245
+ }
246
+
247
+ function isKnownRational(rational) {
248
+ return rational[1] !== 0;
249
+ }
@@ -2,8 +2,36 @@
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 {getEncodedString, getTableDescription, getVersionString} from './tag-names-utils.js';
5
+ import {getEncodedString, getVersionString} from './tag-names-utils.js';
6
6
  import TagNamesCommon from './tag-names-common.js';
7
+ import {
8
+ getOECFDescription,
9
+ getSensitivityTypeDescription,
10
+ getMaxApertureValueDescription,
11
+ getSubjectDistanceDescription,
12
+ getFlashDescription,
13
+ getSecurityClassificationDescription,
14
+ getSubjectAreaDescription,
15
+ getMakerNoteDescription,
16
+ getAmbientTemperatureDescription,
17
+ getHumidityDescription,
18
+ getPressureDescription,
19
+ getWaterDepthDescription,
20
+ getAccelerationDescription,
21
+ getCameraElevationAngleDescription,
22
+ getSpatialFrequencyResponseDescription,
23
+ getSubjectLocationDescription,
24
+ getSensingMethodDescription,
25
+ getFileSourceDescription,
26
+ getSceneTypeDescription,
27
+ getCFAPatternDescription,
28
+ getDigitalZoomRatioDescription,
29
+ getGainControlDescription,
30
+ getDeviceSettingDescriptionDescription,
31
+ getSubjectDistanceRangeDescription,
32
+ getLensSpecificationDescription,
33
+ getCompositeImageDescription
34
+ } from './tag-names-exif-ifd-descriptions.js';
7
35
 
8
36
  export default {
9
37
  0x829a: {
@@ -22,21 +50,13 @@ export default {
22
50
  0x8827: 'ISOSpeedRatings',
23
51
  0x8828: {
24
52
  'name': 'OECF',
25
- 'description': () => '[Raw OECF table data]'
53
+ 'description': getOECFDescription
26
54
  },
27
55
  0x882a: 'TimeZoneOffset',
28
56
  0x882b: 'SelfTimerMode',
29
57
  0x8830: {
30
58
  name: 'SensitivityType',
31
- description: (value) => getTableDescription({
32
- 1: 'Standard Output Sensitivity',
33
- 2: 'Recommended Exposure Index',
34
- 3: 'ISO Speed',
35
- 4: 'Standard Output Sensitivity and Recommended Exposure Index',
36
- 5: 'Standard Output Sensitivity and ISO Speed',
37
- 6: 'Recommended Exposure Index and ISO Speed',
38
- 7: 'Standard Output Sensitivity, Recommended Exposure Index and ISO Speed'
39
- }, value)
59
+ description: getSensitivityTypeDescription
40
60
  },
41
61
  0x8831: 'StandardOutputSensitivity',
42
62
  0x8832: 'RecommendedExposureIndex',
@@ -70,13 +90,11 @@ export default {
70
90
  0x9204: 'ExposureBiasValue',
71
91
  0x9205: {
72
92
  'name': 'MaxApertureValue',
73
- 'description': (value) => {
74
- return Math.pow(Math.sqrt(2), value[0] / value[1]).toFixed(2);
75
- }
93
+ 'description': getMaxApertureValueDescription
76
94
  },
77
95
  0x9206: {
78
96
  'name': 'SubjectDistance',
79
- 'description': (value) => (value[0] / value[1]) + ' m'
97
+ 'description': getSubjectDistanceDescription
80
98
  },
81
99
  0x9207: {
82
100
  'name': 'MeteringMode',
@@ -88,54 +106,7 @@ export default {
88
106
  },
89
107
  0x9209: {
90
108
  'name': 'Flash',
91
- 'description': (value) => {
92
- if (value === 0x00) {
93
- return 'Flash did not fire';
94
- } else if (value === 0x01) {
95
- return 'Flash fired';
96
- } else if (value === 0x05) {
97
- return 'Strobe return light not detected';
98
- } else if (value === 0x07) {
99
- return 'Strobe return light detected';
100
- } else if (value === 0x09) {
101
- return 'Flash fired, compulsory flash mode';
102
- } else if (value === 0x0d) {
103
- return 'Flash fired, compulsory flash mode, return light not detected';
104
- } else if (value === 0x0f) {
105
- return 'Flash fired, compulsory flash mode, return light detected';
106
- } else if (value === 0x10) {
107
- return 'Flash did not fire, compulsory flash mode';
108
- } else if (value === 0x18) {
109
- return 'Flash did not fire, auto mode';
110
- } else if (value === 0x19) {
111
- return 'Flash fired, auto mode';
112
- } else if (value === 0x1d) {
113
- return 'Flash fired, auto mode, return light not detected';
114
- } else if (value === 0x1f) {
115
- return 'Flash fired, auto mode, return light detected';
116
- } else if (value === 0x20) {
117
- return 'No flash function';
118
- } else if (value === 0x41) {
119
- return 'Flash fired, red-eye reduction mode';
120
- } else if (value === 0x45) {
121
- return 'Flash fired, red-eye reduction mode, return light not detected';
122
- } else if (value === 0x47) {
123
- return 'Flash fired, red-eye reduction mode, return light detected';
124
- } else if (value === 0x49) {
125
- return 'Flash fired, compulsory flash mode, red-eye reduction mode';
126
- } else if (value === 0x4d) {
127
- return 'Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected';
128
- } else if (value === 0x4f) {
129
- return 'Flash fired, compulsory flash mode, red-eye reduction mode, return light detected';
130
- } else if (value === 0x59) {
131
- return 'Flash fired, auto mode, red-eye reduction mode';
132
- } else if (value === 0x5d) {
133
- return 'Flash fired, auto mode, return light not detected, red-eye reduction mode';
134
- } else if (value === 0x5f) {
135
- return 'Flash fired, auto mode, return light detected, red-eye reduction mode';
136
- }
137
- return 'Unknown';
138
- }
109
+ 'description': getFlashDescription
139
110
  },
140
111
  0x920a: {
141
112
  'name': 'FocalLength',
@@ -144,31 +115,16 @@ export default {
144
115
  0x9211: 'ImageNumber',
145
116
  0x9212: {
146
117
  name: 'SecurityClassification',
147
- description: (value) => getTableDescription({
148
- 'C': 'Confidential',
149
- 'R': 'Restricted',
150
- 'S': 'Secret',
151
- 'T': 'Top Secret',
152
- 'U': 'Unclassified'
153
- }, value)
118
+ description: getSecurityClassificationDescription
154
119
  },
155
120
  0x9213: 'ImageHistory',
156
121
  0x9214: {
157
122
  'name': 'SubjectArea',
158
- 'description': (value) => {
159
- if (value.length === 2) {
160
- return `Location; X: ${value[0]}, Y: ${value[1]}`;
161
- } else if (value.length === 3) {
162
- return `Circle; X: ${value[0]}, Y: ${value[1]}, diameter: ${value[2]}`;
163
- } else if (value.length === 4) {
164
- return `Rectangle; X: ${value[0]}, Y: ${value[1]}, width: ${value[2]}, height: ${value[3]}`;
165
- }
166
- return 'Unknown';
167
- }
123
+ 'description': getSubjectAreaDescription
168
124
  },
169
125
  0x927c: {
170
126
  'name': 'MakerNote',
171
- 'description': () => '[Raw maker note data]'
127
+ 'description': getMakerNoteDescription
172
128
  },
173
129
  0x9286: {
174
130
  'name': 'UserComment',
@@ -180,27 +136,27 @@ export default {
180
136
  0x935c: 'ImageSourceData',
181
137
  0x9400: {
182
138
  'name': 'AmbientTemperature',
183
- 'description': (value) => (value[0] / value[1]) + ' °C'
139
+ 'description': getAmbientTemperatureDescription
184
140
  },
185
141
  0x9401: {
186
142
  'name': 'Humidity',
187
- 'description': (value) => (value[0] / value[1]) + ' %'
143
+ 'description': getHumidityDescription
188
144
  },
189
145
  0x9402: {
190
146
  'name': 'Pressure',
191
- 'description': (value) => (value[0] / value[1]) + ' hPa'
147
+ 'description': getPressureDescription
192
148
  },
193
149
  0x9403: {
194
150
  'name': 'WaterDepth',
195
- 'description': (value) => (value[0] / value[1]) + ' m'
151
+ 'description': getWaterDepthDescription
196
152
  },
197
153
  0x9404: {
198
154
  'name': 'Acceleration',
199
- 'description': (value) => (value[0] / value[1]) + ' mGal'
155
+ 'description': getAccelerationDescription
200
156
  },
201
157
  0x9405: {
202
158
  'name': 'CameraElevationAngle',
203
- 'description': (value) => (value[0] / value[1]) + ' °'
159
+ 'description': getCameraElevationAngleDescription
204
160
  },
205
161
  0xa000: {
206
162
  'name': 'FlashpixVersion',
@@ -217,7 +173,7 @@ export default {
217
173
  0xa20b: 'FlashEnergy',
218
174
  0xa20c: {
219
175
  'name': 'SpatialFrequencyResponse',
220
- 'description': () => '[Raw SFR table data]'
176
+ 'description': getSpatialFrequencyResponseDescription
221
177
  },
222
178
  0xa20e: 'FocalPlaneXResolution',
223
179
  0xa20f: 'FocalPlaneYResolution',
@@ -227,51 +183,24 @@ export default {
227
183
  },
228
184
  0xa214: {
229
185
  'name': 'SubjectLocation',
230
- 'description': ([x, y]) => `X: ${x}, Y: ${y}`
186
+ 'description': getSubjectLocationDescription
231
187
  },
232
188
  0xa215: 'ExposureIndex',
233
189
  0xa217: {
234
190
  'name': 'SensingMethod',
235
- 'description': (value) => {
236
- if (value === 1) {
237
- return 'Undefined';
238
- } else if (value === 2) {
239
- return 'One-chip color area sensor';
240
- } else if (value === 3) {
241
- return 'Two-chip color area sensor';
242
- } else if (value === 4) {
243
- return 'Three-chip color area sensor';
244
- } else if (value === 5) {
245
- return 'Color sequential area sensor';
246
- } else if (value === 7) {
247
- return 'Trilinear sensor';
248
- } else if (value === 8) {
249
- return 'Color sequential linear sensor';
250
- }
251
- return 'Unknown';
252
- }
191
+ 'description': getSensingMethodDescription
253
192
  },
254
193
  0xa300: {
255
194
  'name': 'FileSource',
256
- 'description': (value) => {
257
- if (value === 3) {
258
- return 'DSC';
259
- }
260
- return 'Unknown';
261
- }
195
+ 'description': getFileSourceDescription
262
196
  },
263
197
  0xa301: {
264
198
  'name': 'SceneType',
265
- 'description': (value) => {
266
- if (value === 1) {
267
- return 'A directly photographed image';
268
- }
269
- return 'Unknown';
270
- }
199
+ 'description': getSceneTypeDescription
271
200
  },
272
201
  0xa302: {
273
202
  'name': 'CFAPattern',
274
- 'description': () => '[Raw CFA pattern table data]'
203
+ 'description': getCFAPatternDescription
275
204
  },
276
205
  0xa401: {
277
206
  'name': 'CustomRendered',
@@ -287,12 +216,7 @@ export default {
287
216
  },
288
217
  0xa404: {
289
218
  'name': 'DigitalZoomRatio',
290
- 'description': (value) => {
291
- if (value[0] === 0) {
292
- return 'Digital zoom was not used';
293
- }
294
- return '' + (value[0] / value[1]);
295
- }
219
+ 'description': getDigitalZoomRatioDescription
296
220
  },
297
221
  0xa405: {
298
222
  'name': 'FocalLengthIn35mmFilm', // Sometimes called FocalLengthIn35mmFormat.
@@ -304,20 +228,7 @@ export default {
304
228
  },
305
229
  0xa407: {
306
230
  'name': 'GainControl',
307
- 'description': (value) => {
308
- if (value === 0) {
309
- return 'None';
310
- } else if (value === 1) {
311
- return 'Low gain up';
312
- } else if (value === 2) {
313
- return 'High gain up';
314
- } else if (value === 3) {
315
- return 'Low gain down';
316
- } else if (value === 4) {
317
- return 'High gain down';
318
- }
319
- return 'Unknown';
320
- }
231
+ 'description': getGainControlDescription
321
232
  },
322
233
  0xa408: {
323
234
  'name': 'Contrast',
@@ -333,40 +244,25 @@ export default {
333
244
  },
334
245
  0xa40b: {
335
246
  'name': 'DeviceSettingDescription',
336
- 'description': () => '[Raw device settings table data]'
247
+ 'description': getDeviceSettingDescriptionDescription
337
248
  },
338
249
  0xa40c: {
339
250
  'name': 'SubjectDistanceRange',
340
- 'description': (value) => {
341
- if (value === 1) {
342
- return 'Macro';
343
- } else if (value === 2) {
344
- return 'Close view';
345
- } else if (value === 3) {
346
- return 'Distant view';
347
- }
348
- return 'Unknown';
349
- }
251
+ 'description': getSubjectDistanceRangeDescription
350
252
  },
351
253
  0xa420: 'ImageUniqueID',
352
254
  0xa430: 'CameraOwnerName',
353
255
  0xa431: 'BodySerialNumber',
354
256
  0xa432: {
355
257
  'name': 'LensSpecification',
356
- 'description': (value) => {
357
- return `${getLensFocalLengths(value[0], value[1])} mm f/${getLensApertures(value[2], value[3])}`;
358
- }
258
+ 'description': getLensSpecificationDescription
359
259
  },
360
260
  0xa433: 'LensMake',
361
261
  0xa434: 'LensModel',
362
262
  0xa435: 'LensSerialNumber',
363
263
  0xa460: {
364
264
  name: 'CompositeImage',
365
- description: (value) => getTableDescription({
366
- 1: 'Not a Composite Image',
367
- 2: 'General Composite Image',
368
- 3: 'Composite Image Captured While Shooting',
369
- }, value)
265
+ description: getCompositeImageDescription
370
266
  },
371
267
  0xa461: 'SourceImageNumberOfCompositeImage',
372
268
  0xa462: 'SourceExposureTimesOfCompositeImage',
@@ -388,31 +284,3 @@ export default {
388
284
  0xfe57: 'Smoothness',
389
285
  0xfe58: 'MoireFilter'
390
286
  };
391
-
392
- function getLensFocalLengths(from, to) {
393
- const focalLengthFrom = getRoundedRational(from);
394
- const focalLengthTo = getRoundedRational(to);
395
- if (focalLengthTo === 0 || focalLengthTo === focalLengthFrom) {
396
- return `${focalLengthFrom}`;
397
- }
398
- return `${focalLengthFrom}-${focalLengthTo}`;
399
- }
400
-
401
- function getLensApertures(wide, long) {
402
- const apertures = [wide, long].filter(isKnownRational).map(getRoundedRational);
403
- if (apertures.length === 0) {
404
- return '?';
405
- }
406
- if (apertures.length === 1 || apertures[1] === 0 || apertures[1] === apertures[0]) {
407
- return `${apertures[0]}`;
408
- }
409
- return `${apertures[0]}-${apertures[1]}`;
410
- }
411
-
412
- function getRoundedRational(rational) {
413
- return parseFloat((rational[0] / rational[1]).toFixed(5));
414
- }
415
-
416
- function isKnownRational(rational) {
417
- return rational[1] !== 0;
418
- }