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.
- package/README.md +398 -27
- package/bin/analyze.js +139 -9
- package/bin/build-pages.js +21 -35
- package/bin/cli.js +81 -13
- package/bin/generate-tag-modules.js +287 -0
- package/dist/exif-reader.js +1 -1
- package/dist/exif-reader.js.map +1 -1
- package/exif-reader.d.ts +213 -38
- package/package.json +71 -11
- package/src/composable/brand.js +10 -0
- package/src/composable/composition-tag-filter.js +97 -0
- package/src/composable/composition.js +195 -0
- package/src/composable/core.d.ts +148 -0
- package/src/composable/core.js +526 -0
- package/src/composable/exif-block-reader.js +197 -0
- package/src/composable/formats/avif.js +19 -0
- package/src/composable/formats/gif.js +28 -0
- package/src/composable/formats/heic.js +19 -0
- package/src/composable/formats/iso-bmff-file-reader.js +14 -0
- package/src/composable/formats/jpeg.js +55 -0
- package/src/composable/formats/jxl.js +30 -0
- package/src/composable/formats/png.js +187 -0
- package/src/composable/formats/tiff.js +18 -0
- package/src/composable/formats/webp.js +28 -0
- package/src/composable/formats/xml.js +18 -0
- package/src/composable/formats.d.ts +17 -0
- package/src/composable/formats.js +17 -0
- package/src/composable/group-helpers.js +129 -0
- package/src/composable/groups/canon.js +26 -0
- package/src/composable/groups/composite.js +43 -0
- package/src/composable/groups/exif.js +48 -0
- package/src/composable/groups/gps.js +75 -0
- package/src/composable/groups/icc.js +52 -0
- package/src/composable/groups/iptc.js +86 -0
- package/src/composable/groups/maker-notes.js +21 -0
- package/src/composable/groups/mpf.js +25 -0
- package/src/composable/groups/pentax.js +34 -0
- package/src/composable/groups/photoshop.js +18 -0
- package/src/composable/groups/thumbnail.js +131 -0
- package/src/composable/groups/xmp.js +118 -0
- package/src/composable/groups.d.ts +20 -0
- package/src/composable/groups.js +105 -0
- package/src/composable/iptc-block-reader.js +44 -0
- package/src/composable/read-view.js +165 -0
- package/src/composable/tag-binding-name.js +17 -0
- package/src/composable/tags/exif.d.ts +295 -0
- package/src/composable/tags/exif.js +396 -0
- package/src/composable/tags/iptc.d.ts +84 -0
- package/src/composable/tags/iptc.js +109 -0
- package/src/composable/value-budget.js +24 -0
- package/src/composite.js +2 -2
- package/src/decompression.js +60 -0
- package/src/engine.js +50 -106
- package/src/errors.js +8 -2
- package/src/exif-reader.d.ts +8 -0
- package/src/exif-reader.js +112 -763
- package/src/file-loaders.js +74 -1
- package/src/file-tags.js +9 -9
- package/src/image-header.js +13 -47
- package/src/iptc-tag-names-descriptions.js +334 -0
- package/src/iptc-tag-names.js +50 -306
- package/src/iptc-tags.js +41 -27
- package/src/jfif-tags.js +9 -9
- package/src/load-auto.js +2 -2
- package/src/loadview-pipeline.js +52 -192
- package/src/node-require.js +15 -2
- package/src/png-text-tags.js +5 -3
- package/src/tag-filter-config.js +24 -15
- package/src/tag-filter.js +15 -3
- package/src/tag-names-0th-ifd-descriptions.js +232 -0
- package/src/tag-names-0th-ifd.js +49 -173
- package/src/tag-names-common.js +263 -211
- package/src/tag-names-exif-ifd-descriptions.js +249 -0
- package/src/tag-names-exif-ifd.js +55 -187
- package/src/tag-names-gps-ifd-descriptions.js +156 -0
- package/src/tag-names-gps-ifd.js +39 -146
- package/src/tag-names-utils.js +28 -3
- package/src/tags-helpers.js +6 -2
- package/src/types.js +2 -0
- package/src/unsupported-format-error.js +21 -0
- package/src/utils.js +22 -85
- package/src/xmp-tag-names.js +42 -21
- package/webpack.config.js +1 -1
|
@@ -0,0 +1,232 @@
|
|
|
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 {joinMapped} from './utils.js';
|
|
6
|
+
import {getTableDescription, isArrayWithoutCharacterCodes, getStringsText} from './tag-names-utils.js';
|
|
7
|
+
|
|
8
|
+
export function getSubfileTypeDescription(value) {
|
|
9
|
+
return getTableDescription({
|
|
10
|
+
0x0: 'Full-resolution image',
|
|
11
|
+
0x1: 'Reduced-resolution image',
|
|
12
|
+
0x2: 'Single page of multi-page image',
|
|
13
|
+
0x3: 'Single page of multi-page reduced-resolution image',
|
|
14
|
+
0x4: 'Transparency mask',
|
|
15
|
+
0x5: 'Transparency mask of reduced-resolution image',
|
|
16
|
+
0x6: 'Transparency mask of multi-page image',
|
|
17
|
+
0x7: 'Transparency mask of reduced-resolution multi-page image',
|
|
18
|
+
0x10001: 'Alternate reduced-resolution image',
|
|
19
|
+
0xffffffff: 'Invalid'
|
|
20
|
+
}, value);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function getOldSubfileTypeDescription(value) {
|
|
24
|
+
return getTableDescription({
|
|
25
|
+
0: 'Full-resolution image',
|
|
26
|
+
1: 'Reduced-resolution image',
|
|
27
|
+
2: 'Single page of multi-page image'
|
|
28
|
+
}, value);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function getThresholdingDescription(value) {
|
|
32
|
+
return getTableDescription({
|
|
33
|
+
1: 'No dithering or halftoning',
|
|
34
|
+
2: 'Ordered dither or halfton',
|
|
35
|
+
3: 'Randomized dither'
|
|
36
|
+
}, value);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function getFillOrderDescription(value) {
|
|
40
|
+
return getTableDescription({
|
|
41
|
+
1: 'Normal',
|
|
42
|
+
2: 'Reversed'
|
|
43
|
+
}, value);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function getOrientationDescription(value) {
|
|
47
|
+
if (value === 1) {
|
|
48
|
+
return 'top-left';
|
|
49
|
+
}
|
|
50
|
+
if (value === 2) {
|
|
51
|
+
return 'top-right';
|
|
52
|
+
}
|
|
53
|
+
if (value === 3) {
|
|
54
|
+
return 'bottom-right';
|
|
55
|
+
}
|
|
56
|
+
if (value === 4) {
|
|
57
|
+
return 'bottom-left';
|
|
58
|
+
}
|
|
59
|
+
if (value === 5) {
|
|
60
|
+
return 'left-top';
|
|
61
|
+
}
|
|
62
|
+
if (value === 6) {
|
|
63
|
+
return 'right-top';
|
|
64
|
+
}
|
|
65
|
+
if (value === 7) {
|
|
66
|
+
return 'right-bottom';
|
|
67
|
+
}
|
|
68
|
+
if (value === 8) {
|
|
69
|
+
return 'left-bottom';
|
|
70
|
+
}
|
|
71
|
+
return 'Undefined';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function getXPositionDescription(value) {
|
|
75
|
+
return '' + Math.round(value[0] / value[1]);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function getYPositionDescription(value) {
|
|
79
|
+
return '' + Math.round(value[0] / value[1]);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function getGrayResponseUnitDescription(value) {
|
|
83
|
+
return getTableDescription({
|
|
84
|
+
1: '0.1',
|
|
85
|
+
2: '0.001',
|
|
86
|
+
3: '0.0001',
|
|
87
|
+
4: '1e-05',
|
|
88
|
+
5: '1e-06'
|
|
89
|
+
}, value);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export function getWhitePointDescription(values) {
|
|
93
|
+
return joinMapped(values, getRationalText, ', ');
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function getPrimaryChromaticitiesDescription(values) {
|
|
97
|
+
return joinMapped(values, getRationalText, ', ');
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function getInkSetDescription(value) {
|
|
101
|
+
return getTableDescription({
|
|
102
|
+
1: 'CMYK',
|
|
103
|
+
2: 'Not CMYK'
|
|
104
|
+
}, value);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function getExtraSamplesDescription(value) {
|
|
108
|
+
return getTableDescription({
|
|
109
|
+
0: 'Unspecified',
|
|
110
|
+
1: 'Associated Alpha',
|
|
111
|
+
2: 'Unassociated Alpha',
|
|
112
|
+
}, value);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export function getSampleFormatDescription(value) {
|
|
116
|
+
if (!Array.isArray(value)) {
|
|
117
|
+
return getSampleFormatText(value);
|
|
118
|
+
}
|
|
119
|
+
return value.map(getSampleFormatText).join(', ');
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export function getYCbCrCoefficientsDescription(values) {
|
|
123
|
+
return values.map((value) => '' + value[0] / value[1]).join('/');
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function getYCbCrPositioningDescription(value) {
|
|
127
|
+
if (value === 1) {
|
|
128
|
+
return 'centered';
|
|
129
|
+
}
|
|
130
|
+
if (value === 2) {
|
|
131
|
+
return 'co-sited';
|
|
132
|
+
}
|
|
133
|
+
return 'undefined ' + value;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
export function getReferenceBlackWhiteDescription(values) {
|
|
137
|
+
return values.map((value) => '' + value[0] / value[1]).join(', ');
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export function getCopyrightDescription(value) {
|
|
141
|
+
return value.join('; ');
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export function getMakerNoteSafetyDescription(value) {
|
|
145
|
+
return getTableDescription({
|
|
146
|
+
0: 'Unsafe',
|
|
147
|
+
1: 'Safe'
|
|
148
|
+
}, value);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export function getProfileEmbedPolicyDescription(value) {
|
|
152
|
+
return getTableDescription({
|
|
153
|
+
0: 'Allow Copying',
|
|
154
|
+
1: 'Embed if Used',
|
|
155
|
+
2: 'Never Embed',
|
|
156
|
+
3: 'No Restrictions'
|
|
157
|
+
}, value);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export function getPreviewColorSpaceDescription(value) {
|
|
161
|
+
return getTableDescription({
|
|
162
|
+
1: 'Gray Gamma 2.2',
|
|
163
|
+
2: 'sRGB',
|
|
164
|
+
3: 'Adobe RGB',
|
|
165
|
+
4: 'ProPhoto RGB'
|
|
166
|
+
}, value);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export function getProfileHueSatMapEncodingDescription(value) {
|
|
170
|
+
return getTableDescription({
|
|
171
|
+
0: 'Linear',
|
|
172
|
+
1: 'sRGB'
|
|
173
|
+
}, value);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export function getProfileLookTableEncodingDescription(value) {
|
|
177
|
+
return getTableDescription({
|
|
178
|
+
0: 'Linear',
|
|
179
|
+
1: 'sRGB'
|
|
180
|
+
}, value);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export function getDefaultBlackRenderDescription(value) {
|
|
184
|
+
return getTableDescription({
|
|
185
|
+
0: 'Auto',
|
|
186
|
+
1: 'None'
|
|
187
|
+
}, value);
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function getRationalText(value) {
|
|
191
|
+
if (!Array.isArray(value)) {
|
|
192
|
+
throw new TypeError('Expected a rational.');
|
|
193
|
+
}
|
|
194
|
+
return `${value[0]}/${value[1]}`;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function getSampleFormatText(sample) {
|
|
198
|
+
const formats = {
|
|
199
|
+
1: 'Unsigned',
|
|
200
|
+
2: 'Signed',
|
|
201
|
+
3: 'Float',
|
|
202
|
+
4: 'Undefined',
|
|
203
|
+
5: 'Complex int',
|
|
204
|
+
6: 'Complex float',
|
|
205
|
+
};
|
|
206
|
+
return getTableDescription(formats, sample);
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export function decodeXPValue(value) {
|
|
210
|
+
if (!Array.isArray(value)) {
|
|
211
|
+
// A one-element value arrives as a bare number, which Uint8Array would take as a length.
|
|
212
|
+
return '';
|
|
213
|
+
}
|
|
214
|
+
if (isArrayWithoutCharacterCodes(value)) {
|
|
215
|
+
// An ASCII-typed value holds strings, not UCS-2 bytes.
|
|
216
|
+
return getStringsText(value);
|
|
217
|
+
}
|
|
218
|
+
// The XP tags are encoded as UCS-2 which uses two bytes per character but
|
|
219
|
+
// it's close to UTF-16 so we can use that to decode them.
|
|
220
|
+
// https://www.loc.gov/preservation/digital/formats/content/tiff_tags.shtml
|
|
221
|
+
const decodedValue = new TextDecoder('utf-16').decode(new Uint8Array(value));
|
|
222
|
+
// Some softwares pad the string with null characters so we remove them.
|
|
223
|
+
return removeTrailingNulls(decodedValue);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function removeTrailingNulls(text) {
|
|
227
|
+
let end = text.length;
|
|
228
|
+
while (end > 0 && text.charCodeAt(end - 1) === 0) {
|
|
229
|
+
end--;
|
|
230
|
+
}
|
|
231
|
+
return text.slice(0, end);
|
|
232
|
+
}
|
package/src/tag-names-0th-ifd.js
CHANGED
|
@@ -3,33 +3,42 @@
|
|
|
3
3
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
|
|
4
4
|
|
|
5
5
|
import TagNamesCommon from './tag-names-common.js';
|
|
6
|
-
import {
|
|
7
|
-
|
|
6
|
+
import {
|
|
7
|
+
getSubfileTypeDescription,
|
|
8
|
+
getOldSubfileTypeDescription,
|
|
9
|
+
getThresholdingDescription,
|
|
10
|
+
getFillOrderDescription,
|
|
11
|
+
getOrientationDescription,
|
|
12
|
+
getXPositionDescription,
|
|
13
|
+
getYPositionDescription,
|
|
14
|
+
getGrayResponseUnitDescription,
|
|
15
|
+
getWhitePointDescription,
|
|
16
|
+
getPrimaryChromaticitiesDescription,
|
|
17
|
+
getInkSetDescription,
|
|
18
|
+
getExtraSamplesDescription,
|
|
19
|
+
getSampleFormatDescription,
|
|
20
|
+
getYCbCrCoefficientsDescription,
|
|
21
|
+
getYCbCrPositioningDescription,
|
|
22
|
+
getReferenceBlackWhiteDescription,
|
|
23
|
+
getCopyrightDescription,
|
|
24
|
+
decodeXPValue,
|
|
25
|
+
getMakerNoteSafetyDescription,
|
|
26
|
+
getProfileEmbedPolicyDescription,
|
|
27
|
+
getPreviewColorSpaceDescription,
|
|
28
|
+
getProfileHueSatMapEncodingDescription,
|
|
29
|
+
getProfileLookTableEncodingDescription,
|
|
30
|
+
getDefaultBlackRenderDescription
|
|
31
|
+
} from './tag-names-0th-ifd-descriptions.js';
|
|
8
32
|
|
|
9
33
|
export default {
|
|
10
34
|
0x000b: 'ProcessingSoftware',
|
|
11
35
|
0x00fe: {
|
|
12
36
|
name: 'SubfileType',
|
|
13
|
-
description:
|
|
14
|
-
0x0: 'Full-resolution image',
|
|
15
|
-
0x1: 'Reduced-resolution image',
|
|
16
|
-
0x2: 'Single page of multi-page image',
|
|
17
|
-
0x3: 'Single page of multi-page reduced-resolution image',
|
|
18
|
-
0x4: 'Transparency mask',
|
|
19
|
-
0x5: 'Transparency mask of reduced-resolution image',
|
|
20
|
-
0x6: 'Transparency mask of multi-page image',
|
|
21
|
-
0x7: 'Transparency mask of reduced-resolution multi-page image',
|
|
22
|
-
0x10001: 'Alternate reduced-resolution image',
|
|
23
|
-
0xffffffff: 'Invalid'
|
|
24
|
-
}, value)
|
|
37
|
+
description: getSubfileTypeDescription
|
|
25
38
|
},
|
|
26
39
|
0x00ff: {
|
|
27
40
|
name: 'OldSubfileType',
|
|
28
|
-
description:
|
|
29
|
-
0: 'Full-resolution image',
|
|
30
|
-
1: 'Reduced-resolution image',
|
|
31
|
-
2: 'Single page of multi-page image'
|
|
32
|
-
}, value)
|
|
41
|
+
description: getOldSubfileTypeDescription
|
|
33
42
|
},
|
|
34
43
|
0x0100: 'ImageWidth',
|
|
35
44
|
0x0101: 'ImageLength',
|
|
@@ -38,20 +47,13 @@ export default {
|
|
|
38
47
|
0x0106: 'PhotometricInterpretation',
|
|
39
48
|
0x0107: {
|
|
40
49
|
name: 'Thresholding',
|
|
41
|
-
description:
|
|
42
|
-
1: 'No dithering or halftoning',
|
|
43
|
-
2: 'Ordered dither or halfton',
|
|
44
|
-
3: 'Randomized dither'
|
|
45
|
-
}, value)
|
|
50
|
+
description: getThresholdingDescription
|
|
46
51
|
},
|
|
47
52
|
0x0108: 'CellWidth',
|
|
48
53
|
0x0109: 'CellLength',
|
|
49
54
|
0x010a: {
|
|
50
55
|
name: 'FillOrder',
|
|
51
|
-
description:
|
|
52
|
-
1: 'Normal',
|
|
53
|
-
2: 'Reversed'
|
|
54
|
-
}, value)
|
|
56
|
+
description: getFillOrderDescription
|
|
55
57
|
},
|
|
56
58
|
0x010d: 'DocumentName',
|
|
57
59
|
0x010e: 'ImageDescription',
|
|
@@ -60,33 +62,7 @@ export default {
|
|
|
60
62
|
0x0111: 'StripOffsets',
|
|
61
63
|
0x0112: {
|
|
62
64
|
name: 'Orientation',
|
|
63
|
-
description:
|
|
64
|
-
if (value === 1) {
|
|
65
|
-
return 'top-left';
|
|
66
|
-
}
|
|
67
|
-
if (value === 2) {
|
|
68
|
-
return 'top-right';
|
|
69
|
-
}
|
|
70
|
-
if (value === 3) {
|
|
71
|
-
return 'bottom-right';
|
|
72
|
-
}
|
|
73
|
-
if (value === 4) {
|
|
74
|
-
return 'bottom-left';
|
|
75
|
-
}
|
|
76
|
-
if (value === 5) {
|
|
77
|
-
return 'left-top';
|
|
78
|
-
}
|
|
79
|
-
if (value === 6) {
|
|
80
|
-
return 'right-top';
|
|
81
|
-
}
|
|
82
|
-
if (value === 7) {
|
|
83
|
-
return 'right-bottom';
|
|
84
|
-
}
|
|
85
|
-
if (value === 8) {
|
|
86
|
-
return 'left-bottom';
|
|
87
|
-
}
|
|
88
|
-
return 'Undefined';
|
|
89
|
-
}
|
|
65
|
+
description: getOrientationDescription
|
|
90
66
|
},
|
|
91
67
|
0x0115: 'SamplesPerPixel',
|
|
92
68
|
0x0116: 'RowsPerStrip',
|
|
@@ -105,25 +81,15 @@ export default {
|
|
|
105
81
|
0x011d: 'PageName',
|
|
106
82
|
0x011e: {
|
|
107
83
|
'name': 'XPosition',
|
|
108
|
-
'description':
|
|
109
|
-
return '' + Math.round(value[0] / value[1]);
|
|
110
|
-
}
|
|
84
|
+
'description': getXPositionDescription
|
|
111
85
|
},
|
|
112
86
|
0x011f: {
|
|
113
87
|
'name': 'YPosition',
|
|
114
|
-
'description':
|
|
115
|
-
return '' + Math.round(value[0] / value[1]);
|
|
116
|
-
}
|
|
88
|
+
'description': getYPositionDescription
|
|
117
89
|
},
|
|
118
90
|
0x0122: {
|
|
119
91
|
name: 'GrayResponseUnit',
|
|
120
|
-
description:
|
|
121
|
-
1: '0.1',
|
|
122
|
-
2: '0.001',
|
|
123
|
-
3: '0.0001',
|
|
124
|
-
4: '1e-05',
|
|
125
|
-
5: '1e-06'
|
|
126
|
-
}, value)
|
|
92
|
+
description: getGrayResponseUnitDescription
|
|
127
93
|
},
|
|
128
94
|
0x0128: {
|
|
129
95
|
name: 'ResolutionUnit',
|
|
@@ -138,11 +104,11 @@ export default {
|
|
|
138
104
|
0x013d: 'Predictor',
|
|
139
105
|
0x013e: {
|
|
140
106
|
'name': 'WhitePoint',
|
|
141
|
-
'description':
|
|
107
|
+
'description': getWhitePointDescription
|
|
142
108
|
},
|
|
143
109
|
0x013f: {
|
|
144
110
|
'name': 'PrimaryChromaticities',
|
|
145
|
-
'description':
|
|
111
|
+
'description': getPrimaryChromaticitiesDescription
|
|
146
112
|
},
|
|
147
113
|
0x0141: 'HalftoneHints',
|
|
148
114
|
0x0142: 'TileWidth',
|
|
@@ -150,62 +116,38 @@ export default {
|
|
|
150
116
|
0x014a: 'A100DataOffset',
|
|
151
117
|
0x014c: {
|
|
152
118
|
name: 'InkSet',
|
|
153
|
-
description:
|
|
154
|
-
1: 'CMYK',
|
|
155
|
-
2: 'Not CMYK'
|
|
156
|
-
}, value)
|
|
119
|
+
description: getInkSetDescription
|
|
157
120
|
},
|
|
158
121
|
0x0151: 'TargetPrinter',
|
|
159
122
|
0x0152: {
|
|
160
123
|
name: 'ExtraSamples',
|
|
161
|
-
description:
|
|
162
|
-
0: 'Unspecified',
|
|
163
|
-
1: 'Associated Alpha',
|
|
164
|
-
2: 'Unassociated Alpha',
|
|
165
|
-
}, value)
|
|
124
|
+
description: getExtraSamplesDescription
|
|
166
125
|
},
|
|
167
126
|
0x0153: {
|
|
168
127
|
name: 'SampleFormat',
|
|
169
|
-
description:
|
|
170
|
-
if (!Array.isArray(value)) {
|
|
171
|
-
return getSampleFormatText(value);
|
|
172
|
-
}
|
|
173
|
-
return value.map(getSampleFormatText).join(', ');
|
|
174
|
-
}
|
|
128
|
+
description: getSampleFormatDescription
|
|
175
129
|
},
|
|
176
130
|
0x0201: 'JPEGInterchangeFormat',
|
|
177
131
|
0x0202: 'JPEGInterchangeFormatLength',
|
|
178
132
|
0x0211: {
|
|
179
133
|
'name': 'YCbCrCoefficients',
|
|
180
|
-
'description':
|
|
181
|
-
return values.map((value) => '' + value[0] / value[1]).join('/');
|
|
182
|
-
}
|
|
134
|
+
'description': getYCbCrCoefficientsDescription
|
|
183
135
|
},
|
|
184
136
|
0x0212: 'YCbCrSubSampling',
|
|
185
137
|
0x0213: {
|
|
186
138
|
name: 'YCbCrPositioning',
|
|
187
|
-
description:
|
|
188
|
-
if (value === 1) {
|
|
189
|
-
return 'centered';
|
|
190
|
-
}
|
|
191
|
-
if (value === 2) {
|
|
192
|
-
return 'co-sited';
|
|
193
|
-
}
|
|
194
|
-
return 'undefined ' + value;
|
|
195
|
-
}
|
|
139
|
+
description: getYCbCrPositioningDescription
|
|
196
140
|
},
|
|
197
141
|
0x0214: {
|
|
198
142
|
'name': 'ReferenceBlackWhite',
|
|
199
|
-
'description':
|
|
200
|
-
return values.map((value) => '' + value[0] / value[1]).join(', ');
|
|
201
|
-
}
|
|
143
|
+
'description': getReferenceBlackWhiteDescription
|
|
202
144
|
},
|
|
203
145
|
0x02bc: 'ApplicationNotes',
|
|
204
146
|
0x4746: 'Rating',
|
|
205
147
|
0x4749: 'RatingPercent',
|
|
206
148
|
0x8298: {
|
|
207
149
|
name: 'Copyright',
|
|
208
|
-
description:
|
|
150
|
+
description: getCopyrightDescription
|
|
209
151
|
},
|
|
210
152
|
0x830e: 'PixelScale',
|
|
211
153
|
0x83bb: 'IPTC-NAA',
|
|
@@ -264,10 +206,7 @@ export default {
|
|
|
264
206
|
0xc633: 'ShadowScale',
|
|
265
207
|
0xc635: {
|
|
266
208
|
name: 'MakerNoteSafety',
|
|
267
|
-
description:
|
|
268
|
-
0: 'Unsafe',
|
|
269
|
-
1: 'Safe'
|
|
270
|
-
}, value)
|
|
209
|
+
description: getMakerNoteSafetyDescription
|
|
271
210
|
},
|
|
272
211
|
0xc65a: {
|
|
273
212
|
name: 'CalibrationIlluminant1',
|
|
@@ -299,12 +238,7 @@ export default {
|
|
|
299
238
|
0xc6fc: 'ProfileToneCurve',
|
|
300
239
|
0xc6fd: {
|
|
301
240
|
name: 'ProfileEmbedPolicy',
|
|
302
|
-
description:
|
|
303
|
-
0: 'Allow Copying',
|
|
304
|
-
1: 'Embed if Used',
|
|
305
|
-
2: 'Never Embed',
|
|
306
|
-
3: 'No Restrictions'
|
|
307
|
-
}, value)
|
|
241
|
+
description: getProfileEmbedPolicyDescription
|
|
308
242
|
},
|
|
309
243
|
0xc6fe: 'ProfileCopyright',
|
|
310
244
|
0xc714: 'ForwardMatrix1',
|
|
@@ -315,12 +249,7 @@ export default {
|
|
|
315
249
|
0xc719: 'PreviewSettingsDigest',
|
|
316
250
|
0xc71a: {
|
|
317
251
|
name: 'PreviewColorSpace',
|
|
318
|
-
description:
|
|
319
|
-
1: 'Gray Gamma 2.2',
|
|
320
|
-
2: 'sRGB',
|
|
321
|
-
3: 'Adobe RGB',
|
|
322
|
-
4: 'ProPhoto RGB'
|
|
323
|
-
}, value)
|
|
252
|
+
description: getPreviewColorSpaceDescription
|
|
324
253
|
},
|
|
325
254
|
0xc71b: 'PreviewDateTime',
|
|
326
255
|
0xc71c: 'RawImageDigest',
|
|
@@ -337,70 +266,17 @@ export default {
|
|
|
337
266
|
0xc7a1: 'CameraLabel',
|
|
338
267
|
0xc7a3: {
|
|
339
268
|
name: 'ProfileHueSatMapEncoding',
|
|
340
|
-
description:
|
|
341
|
-
0: 'Linear',
|
|
342
|
-
1: 'sRGB'
|
|
343
|
-
}, value)
|
|
269
|
+
description: getProfileHueSatMapEncodingDescription
|
|
344
270
|
},
|
|
345
271
|
0xc7a4: {
|
|
346
272
|
name: 'ProfileLookTableEncoding',
|
|
347
|
-
description:
|
|
348
|
-
0: 'Linear',
|
|
349
|
-
1: 'sRGB'
|
|
350
|
-
}, value)
|
|
273
|
+
description: getProfileLookTableEncodingDescription
|
|
351
274
|
},
|
|
352
275
|
0xc7a5: 'BaselineExposureOffset',
|
|
353
276
|
0xc7a6: {
|
|
354
277
|
name: 'DefaultBlackRender',
|
|
355
|
-
description:
|
|
356
|
-
0: 'Auto',
|
|
357
|
-
1: 'None'
|
|
358
|
-
}, value)
|
|
278
|
+
description: getDefaultBlackRenderDescription
|
|
359
279
|
},
|
|
360
280
|
0xc7a7: 'NewRawImageDigest',
|
|
361
281
|
0xc7a8: 'RawToPreviewGain'
|
|
362
282
|
};
|
|
363
|
-
|
|
364
|
-
function getRationalText(value) {
|
|
365
|
-
if (!Array.isArray(value)) {
|
|
366
|
-
throw new TypeError('Expected a rational.');
|
|
367
|
-
}
|
|
368
|
-
return `${value[0]}/${value[1]}`;
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
function getSampleFormatText(sample) {
|
|
372
|
-
const formats = {
|
|
373
|
-
1: 'Unsigned',
|
|
374
|
-
2: 'Signed',
|
|
375
|
-
3: 'Float',
|
|
376
|
-
4: 'Undefined',
|
|
377
|
-
5: 'Complex int',
|
|
378
|
-
6: 'Complex float',
|
|
379
|
-
};
|
|
380
|
-
return getTableDescription(formats, sample);
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
function decodeXPValue(value) {
|
|
384
|
-
if (!Array.isArray(value)) {
|
|
385
|
-
// A one-element value arrives as a bare number, which Uint8Array would take as a length.
|
|
386
|
-
return '';
|
|
387
|
-
}
|
|
388
|
-
if (isArrayWithoutCharacterCodes(value)) {
|
|
389
|
-
// An ASCII-typed value holds strings, not UCS-2 bytes.
|
|
390
|
-
return getStringsText(value);
|
|
391
|
-
}
|
|
392
|
-
// The XP tags are encoded as UCS-2 which uses two bytes per character but
|
|
393
|
-
// it's close to UTF-16 so we can use that to decode them.
|
|
394
|
-
// https://www.loc.gov/preservation/digital/formats/content/tiff_tags.shtml
|
|
395
|
-
const decodedValue = new TextDecoder('utf-16').decode(new Uint8Array(value));
|
|
396
|
-
// Some softwares pad the string with null characters so we remove them.
|
|
397
|
-
return removeTrailingNulls(decodedValue);
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
function removeTrailingNulls(text) {
|
|
401
|
-
let end = text.length;
|
|
402
|
-
while (end > 0 && text.charCodeAt(end - 1) === 0) {
|
|
403
|
-
end--;
|
|
404
|
-
}
|
|
405
|
-
return text.slice(0, end);
|
|
406
|
-
}
|