exifreader 4.39.1 → 4.40.1
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 +324 -166
- package/bin/profile-diff.js +171 -0
- package/bin/profile.js +852 -0
- package/dist/exif-reader.js +1 -1
- package/dist/exif-reader.js.map +1 -1
- package/exif-reader.d.ts +53 -10
- package/package.json +7 -7
- package/src/exif-reader.js +50 -143
- package/src/file-loaders.js +313 -0
- package/src/image-header-avif.js +8 -5
- package/src/image-header-gif.js +21 -1
- package/src/image-header-heic.js +8 -5
- package/src/image-header-iso-bmff-utils.js +11 -0
- package/src/image-header-iso-bmff.js +226 -53
- package/src/image-header-jpeg.js +53 -1
- package/src/image-header-jxl.js +63 -12
- package/src/image-header-png.js +68 -17
- package/src/image-header-webp.js +32 -2
- package/src/image-header.js +32 -12
- package/src/load-auto.js +305 -0
- package/src/loadview-pipeline.js +66 -1
- package/src/mpf-tags.js +19 -15
- package/src/pentax-tags.js +26 -22
- package/src/utils.js +3 -1
- package/src/vp8x-tags.js +5 -0
- package/src/xml.js +39 -1
package/exif-reader.d.ts
CHANGED
|
@@ -237,6 +237,37 @@ export interface ExpandedTags {
|
|
|
237
237
|
photoshop?: PhotoshopTags;
|
|
238
238
|
makerNotes?: CanonTags & PentaxTags;
|
|
239
239
|
composite?: CompositeTags;
|
|
240
|
+
metadataRange?: MetadataRange;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export type MetadataBlockType =
|
|
244
|
+
| 'exif'
|
|
245
|
+
| 'iptc'
|
|
246
|
+
| 'xmp'
|
|
247
|
+
| 'icc'
|
|
248
|
+
| 'mpf'
|
|
249
|
+
| 'mpfImage'
|
|
250
|
+
| 'jfif'
|
|
251
|
+
| 'file'
|
|
252
|
+
| 'png'
|
|
253
|
+
| 'riff'
|
|
254
|
+
| 'gif';
|
|
255
|
+
|
|
256
|
+
export interface MetadataBlock {
|
|
257
|
+
type: MetadataBlockType,
|
|
258
|
+
start: number,
|
|
259
|
+
end: number,
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export interface MetadataRange {
|
|
263
|
+
start: number,
|
|
264
|
+
end: number,
|
|
265
|
+
complete: boolean,
|
|
266
|
+
blocks: MetadataBlock[],
|
|
267
|
+
// Only present when length: 'auto' was used:
|
|
268
|
+
buffer?: ArrayBuffer | SharedArrayBuffer | Buffer,
|
|
269
|
+
fetched?: number,
|
|
270
|
+
requests?: number,
|
|
240
271
|
}
|
|
241
272
|
|
|
242
273
|
interface GpsTags {
|
|
@@ -387,19 +418,31 @@ type CommonOptions = {
|
|
|
387
418
|
decompress?: DecompressOptions,
|
|
388
419
|
};
|
|
389
420
|
|
|
421
|
+
type ExpandedOnly = {expanded: true, includeOffsets?: boolean};
|
|
422
|
+
type FlatOnly = {expanded?: false, includeOffsets?: false};
|
|
423
|
+
|
|
424
|
+
type AutoLengthOptions = {
|
|
425
|
+
length: 'auto',
|
|
426
|
+
expanded: true,
|
|
427
|
+
includeOffsets: true,
|
|
428
|
+
async?: boolean,
|
|
429
|
+
};
|
|
430
|
+
|
|
390
431
|
export function load(data: ArrayBuffer | SharedArrayBuffer | Buffer): Tags;
|
|
391
|
-
export function load(data: ArrayBuffer | SharedArrayBuffer | Buffer, options: CommonOptions &
|
|
392
|
-
export function load(data: ArrayBuffer | SharedArrayBuffer | Buffer, options: CommonOptions &
|
|
393
|
-
export function load(data: ArrayBuffer | SharedArrayBuffer | Buffer, options: CommonOptions &
|
|
394
|
-
export function load(data: ArrayBuffer | SharedArrayBuffer | Buffer, options: CommonOptions &
|
|
432
|
+
export function load(data: ArrayBuffer | SharedArrayBuffer | Buffer, options: CommonOptions & AutoLengthOptions): Promise<ExpandedTags>;
|
|
433
|
+
export function load(data: ArrayBuffer | SharedArrayBuffer | Buffer, options: CommonOptions & ExpandedOnly & {length?: number, async?: false}): ExpandedTags;
|
|
434
|
+
export function load(data: ArrayBuffer | SharedArrayBuffer | Buffer, options: CommonOptions & FlatOnly & {length?: number, async?: false}): Tags;
|
|
435
|
+
export function load(data: ArrayBuffer | SharedArrayBuffer | Buffer, options: CommonOptions & ExpandedOnly & {length?: number, async: true}): Promise<ExpandedTags>;
|
|
436
|
+
export function load(data: ArrayBuffer | SharedArrayBuffer | Buffer, options: CommonOptions & FlatOnly & {length?: number, async: true}): Promise<Tags>;
|
|
395
437
|
export function load(data: string | File): Promise<Tags>;
|
|
396
|
-
export function load(data: string | File, options: CommonOptions &
|
|
397
|
-
export function load(data: string | File, options: CommonOptions &
|
|
438
|
+
export function load(data: string | File, options: CommonOptions & AutoLengthOptions): Promise<ExpandedTags>;
|
|
439
|
+
export function load(data: string | File, options: CommonOptions & ExpandedOnly & {length?: number, async?: boolean }): Promise<ExpandedTags>;
|
|
440
|
+
export function load(data: string | File, options: CommonOptions & FlatOnly & {length?: number, async?: boolean }): Promise<Tags>;
|
|
398
441
|
export function loadView(data: DataView): Tags;
|
|
399
|
-
export function loadView(data: DataView, options: CommonOptions &
|
|
400
|
-
export function loadView(data: DataView, options: CommonOptions &
|
|
401
|
-
export function loadView(data: DataView, options: CommonOptions &
|
|
402
|
-
export function loadView(data: DataView, options: CommonOptions &
|
|
442
|
+
export function loadView(data: DataView, options: CommonOptions & ExpandedOnly & {async?: false}): ExpandedTags;
|
|
443
|
+
export function loadView(data: DataView, options: CommonOptions & FlatOnly & {async?: false}): Tags;
|
|
444
|
+
export function loadView(data: DataView, options: CommonOptions & ExpandedOnly & {async: true}): Promise<ExpandedTags>;
|
|
445
|
+
export function loadView(data: DataView, options: CommonOptions & FlatOnly & {async: true}): Promise<Tags>;
|
|
403
446
|
|
|
404
447
|
export namespace errors {
|
|
405
448
|
export class MetadataMissingError extends Error {}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "exifreader",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.40.1",
|
|
4
4
|
"description": "Library that parses Exif metadata in images.",
|
|
5
5
|
"author": "Mattias Wallander <mattias@wallander.eu>",
|
|
6
6
|
"repository": {
|
|
@@ -28,26 +28,26 @@
|
|
|
28
28
|
"@babel/core": "^7.25.2",
|
|
29
29
|
"@babel/preset-env": "^7.29.5",
|
|
30
30
|
"@babel/register": "^7.29.3",
|
|
31
|
-
"@types/node": "^25.
|
|
31
|
+
"@types/node": "^25.9.1",
|
|
32
32
|
"babel-loader": "^10.0.0",
|
|
33
33
|
"babel-plugin-rewire": "^1.2.0",
|
|
34
34
|
"chai": "^4.3.10",
|
|
35
35
|
"cross-env": "^10.0.0",
|
|
36
|
-
"cypress": "^15.
|
|
36
|
+
"cypress": "^15.15.0",
|
|
37
37
|
"eslint": "^8.52.0",
|
|
38
38
|
"eslint-plugin-cypress": "^3.0.2",
|
|
39
39
|
"husky": "^9.0.11",
|
|
40
40
|
"linkedom": "^0.18.9",
|
|
41
|
-
"mocha": "^11.
|
|
41
|
+
"mocha": "^11.7.6",
|
|
42
42
|
"npm-run-all": "^4.1.5",
|
|
43
43
|
"nyc": "^18.0.0",
|
|
44
44
|
"rimraf": "^5.0.5",
|
|
45
45
|
"string-replace-loader": "^3.1.0",
|
|
46
|
-
"terser-webpack-plugin": "^5.
|
|
46
|
+
"terser-webpack-plugin": "^5.6.0",
|
|
47
47
|
"typescript": "^6.0.3",
|
|
48
|
-
"webpack": "5.
|
|
48
|
+
"webpack": "5.107.1",
|
|
49
49
|
"webpack-cli": "^7.0.0",
|
|
50
|
-
"webpack-dev-server": "^5.
|
|
50
|
+
"webpack-dev-server": "^5.2.4"
|
|
51
51
|
},
|
|
52
52
|
"scripts": {
|
|
53
53
|
"build": "node bin/build.js",
|
package/src/exif-reader.js
CHANGED
|
@@ -6,13 +6,16 @@
|
|
|
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/.
|
|
8
8
|
*/
|
|
9
|
-
/* global Buffer
|
|
9
|
+
/* global Buffer */
|
|
10
10
|
|
|
11
|
-
import {objectAssign,
|
|
11
|
+
import {objectAssign, decompress, COMPRESSION_METHOD_BROTLI} from './utils.js';
|
|
12
|
+
import {isFilePathOrURL, isBrowserFileObject, loadFile, loadFileObject} from './file-loaders.js';
|
|
13
|
+
import {makeLoadAuto, validateAutoOptions} from './load-auto.js';
|
|
12
14
|
import DataViewWrapper from './dataview.js';
|
|
13
15
|
import Constants from './constants.js';
|
|
14
16
|
import {getStringValueFromArray} from './utils.js';
|
|
15
17
|
import {getCalculatedGpsValue} from './tag-names-utils.js';
|
|
18
|
+
import ByteOrder from './byte-order.js';
|
|
16
19
|
import {getTiffHeaderOffset} from './image-header-iso-bmff.js';
|
|
17
20
|
import ImageHeader from './image-header.js';
|
|
18
21
|
import Tags from './tags.js';
|
|
@@ -46,153 +49,29 @@ export default {
|
|
|
46
49
|
export const errors = exifErrors;
|
|
47
50
|
|
|
48
51
|
export function load(data, options = {}) {
|
|
52
|
+
if (options.length === 'auto') {
|
|
53
|
+
validateAutoOptions(options);
|
|
54
|
+
return makeLoadAuto(loadFromData)(data, options);
|
|
55
|
+
}
|
|
49
56
|
if (isFilePathOrURL(data)) {
|
|
50
|
-
options.async = true;
|
|
51
|
-
|
|
52
57
|
if (typeof Promise === 'undefined') {
|
|
53
58
|
throw new Error('Promise is required when async mode is enabled.');
|
|
54
59
|
}
|
|
60
|
+
const asyncOptions = objectAssign({}, options, {async: true});
|
|
55
61
|
|
|
56
|
-
return loadFile(data,
|
|
62
|
+
return loadFile(data, asyncOptions).then((fileContents) => loadFromData(fileContents, asyncOptions));
|
|
57
63
|
}
|
|
58
64
|
if (isBrowserFileObject(data)) {
|
|
59
|
-
options.async = true;
|
|
60
|
-
|
|
61
65
|
if (typeof Promise === 'undefined') {
|
|
62
66
|
throw new Error('Promise is required when async mode is enabled.');
|
|
63
67
|
}
|
|
68
|
+
const asyncOptions = objectAssign({}, options, {async: true});
|
|
64
69
|
|
|
65
|
-
return loadFileObject(data,
|
|
70
|
+
return loadFileObject(data, asyncOptions).then((fileContents) => loadFromData(fileContents, asyncOptions));
|
|
66
71
|
}
|
|
67
72
|
return loadFromData(data, options);
|
|
68
73
|
}
|
|
69
74
|
|
|
70
|
-
function isFilePathOrURL(data) {
|
|
71
|
-
return typeof data === 'string';
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
function loadFile(filename, options) {
|
|
75
|
-
if (/^\w+:\/\//.test(filename)) {
|
|
76
|
-
if (typeof fetch !== 'undefined') {
|
|
77
|
-
return fetchRemoteFile(filename, options);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
return nodeGetRemoteFile(filename, options);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (isDataUri(filename)) {
|
|
84
|
-
return Promise.resolve(dataUriToBuffer(filename));
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
return loadLocalFile(filename, options);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
function fetchRemoteFile(url, {length} = {}) {
|
|
91
|
-
const options = {method: 'GET'};
|
|
92
|
-
if (Number.isInteger(length) && length >= 0) {
|
|
93
|
-
options.headers = {
|
|
94
|
-
range: `bytes=0-${length - 1}`,
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
return fetch(url, options).then((response) => response.arrayBuffer());
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
function nodeGetRemoteFile(url, {length} = {}) {
|
|
101
|
-
return new Promise((resolve, reject) => {
|
|
102
|
-
const options = {};
|
|
103
|
-
if (Number.isInteger(length) && length >= 0) {
|
|
104
|
-
options.headers = {
|
|
105
|
-
range: `bytes=0-${length - 1}`,
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
const get = requireNodeGet(url);
|
|
110
|
-
get(url, options, (response) => {
|
|
111
|
-
if ((response.statusCode >= 200) && (response.statusCode <= 299)) {
|
|
112
|
-
const data = [];
|
|
113
|
-
response.on('data', (chunk) => data.push(Buffer.from(chunk)));
|
|
114
|
-
response.on('error', (error) => reject(error));
|
|
115
|
-
response.on('end', () => resolve(Buffer.concat(data)));
|
|
116
|
-
} else {
|
|
117
|
-
reject(`Could not fetch file: ${response.statusCode} ${response.statusMessage}`);
|
|
118
|
-
response.resume();
|
|
119
|
-
}
|
|
120
|
-
}).on('error', (error) => reject(error));
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
function requireNodeGet(url) {
|
|
125
|
-
if (/^https:\/\//.test(url)) {
|
|
126
|
-
return __non_webpack_require__('https').get;
|
|
127
|
-
}
|
|
128
|
-
return __non_webpack_require__('http').get;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
function isDataUri(filename) {
|
|
132
|
-
return /^data:[^;,]*(;base64)?,/.test(filename);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function loadLocalFile(filename, {length} = {}) {
|
|
136
|
-
return new Promise((resolve, reject) => {
|
|
137
|
-
const fs = requireNodeFs();
|
|
138
|
-
fs.open(filename, (error, fd) => {
|
|
139
|
-
if (error) {
|
|
140
|
-
reject(error);
|
|
141
|
-
} else {
|
|
142
|
-
fs.stat(filename, (error, stat) => {
|
|
143
|
-
if (error) {
|
|
144
|
-
reject(error);
|
|
145
|
-
} else {
|
|
146
|
-
const size = Math.min(stat.size, length !== undefined ? length : stat.size);
|
|
147
|
-
const buffer = Buffer.alloc(size);
|
|
148
|
-
const options = {
|
|
149
|
-
buffer,
|
|
150
|
-
length: size
|
|
151
|
-
};
|
|
152
|
-
fs.read(fd, options, (error) => {
|
|
153
|
-
if (error) {
|
|
154
|
-
reject(error);
|
|
155
|
-
} else {
|
|
156
|
-
fs.close(fd, (error) => {
|
|
157
|
-
if (error) {
|
|
158
|
-
console.warn(`Could not close file ${filename}:`, error); // eslint-disable-line no-console
|
|
159
|
-
}
|
|
160
|
-
resolve(buffer);
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
}
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
function requireNodeFs() {
|
|
172
|
-
try {
|
|
173
|
-
return __non_webpack_require__('fs');
|
|
174
|
-
} catch (error) {
|
|
175
|
-
return undefined;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
function isBrowserFileObject(data) {
|
|
180
|
-
return (typeof File !== 'undefined') && (data instanceof File);
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
function loadFileObject(file, {length}) {
|
|
184
|
-
return new Promise((resolve, reject) => {
|
|
185
|
-
const reader = new FileReader();
|
|
186
|
-
reader.onload = (readerEvent) => resolve(readerEvent.target.result);
|
|
187
|
-
reader.onerror = () => reject(reader.error);
|
|
188
|
-
if (Number.isInteger(length) && length >= 0 && file.slice !== undefined) {
|
|
189
|
-
reader.readAsArrayBuffer(file.slice(0, length));
|
|
190
|
-
} else {
|
|
191
|
-
reader.readAsArrayBuffer(file);
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
}
|
|
195
|
-
|
|
196
75
|
function loadFromData(data, options) {
|
|
197
76
|
if (isNodeBuffer(data)) {
|
|
198
77
|
// File data read in Node can share the underlying buffer with other
|
|
@@ -225,19 +104,21 @@ export function loadView(
|
|
|
225
104
|
async = false,
|
|
226
105
|
computed = false,
|
|
227
106
|
includeUnknown = false,
|
|
107
|
+
includeOffsets = false,
|
|
228
108
|
domParser = undefined,
|
|
229
109
|
includeTags = undefined,
|
|
230
110
|
excludeTags = undefined,
|
|
231
|
-
decompress: decompressConfig = undefined
|
|
111
|
+
decompress: decompressConfig = undefined
|
|
232
112
|
} = {
|
|
233
113
|
expanded: false,
|
|
234
114
|
async: false,
|
|
235
115
|
computed: false,
|
|
236
116
|
includeUnknown: false,
|
|
117
|
+
includeOffsets: false,
|
|
237
118
|
domParser: undefined,
|
|
238
119
|
includeTags: undefined,
|
|
239
120
|
excludeTags: undefined,
|
|
240
|
-
decompress: undefined
|
|
121
|
+
decompress: undefined
|
|
241
122
|
}
|
|
242
123
|
) {
|
|
243
124
|
const tagFilter = createTagFilter({includeTags, excludeTags});
|
|
@@ -265,8 +146,12 @@ export function loadView(
|
|
|
265
146
|
gifHeaderOffset,
|
|
266
147
|
brobExifChunk,
|
|
267
148
|
brobXmpChunk,
|
|
268
|
-
jxlCodestreamOffset
|
|
269
|
-
|
|
149
|
+
jxlCodestreamOffset,
|
|
150
|
+
metadataBlocks,
|
|
151
|
+
metadataTruncated,
|
|
152
|
+
exifDataView,
|
|
153
|
+
xmpDataView
|
|
154
|
+
} = ImageHeader.parseAppMarkers(dataView, async, expanded && includeOffsets);
|
|
270
155
|
|
|
271
156
|
const fileHasMetaData = hasPotentialMetaData({
|
|
272
157
|
fileType,
|
|
@@ -329,8 +214,8 @@ export function loadView(
|
|
|
329
214
|
&& hasExifData(tiffHeaderOffset)
|
|
330
215
|
&& tagFilter.shouldParseGroup('exif')
|
|
331
216
|
) {
|
|
332
|
-
const {tags: readTags, byteOrder} =
|
|
333
|
-
dataView,
|
|
217
|
+
const {tags: readTags, byteOrder} = readExifTagsSafely(
|
|
218
|
+
exifDataView || dataView,
|
|
334
219
|
tiffHeaderOffset,
|
|
335
220
|
includeUnknown,
|
|
336
221
|
computed,
|
|
@@ -458,7 +343,7 @@ export function loadView(
|
|
|
458
343
|
) {
|
|
459
344
|
if (hasCanonData(parsedExifTags)) {
|
|
460
345
|
const readCanonTags = CanonTags.read(
|
|
461
|
-
dataView,
|
|
346
|
+
exifDataView || dataView,
|
|
462
347
|
tiffHeaderOffset,
|
|
463
348
|
parsedExifTags['MakerNote'].__offset,
|
|
464
349
|
byteOrder,
|
|
@@ -476,7 +361,7 @@ export function loadView(
|
|
|
476
361
|
}
|
|
477
362
|
} else if (hasPentaxType1Data(parsedExifTags)) {
|
|
478
363
|
const readPentaxTags = PentaxTags.read(
|
|
479
|
-
dataView,
|
|
364
|
+
exifDataView || dataView,
|
|
480
365
|
tiffHeaderOffset,
|
|
481
366
|
parsedExifTags['MakerNote'].__offset,
|
|
482
367
|
includeUnknown,
|
|
@@ -536,7 +421,7 @@ export function loadView(
|
|
|
536
421
|
&& hasXmpData(xmpChunks)
|
|
537
422
|
&& tagFilter.shouldParseGroup('xmp')
|
|
538
423
|
) {
|
|
539
|
-
const readTags = XmpTags.read(dataView, xmpChunks, domParser);
|
|
424
|
+
const readTags = XmpTags.read(xmpDataView || dataView, xmpChunks, domParser);
|
|
540
425
|
const parsedXmpTags = filterTagsForParse('xmp', readTags, tagFilter);
|
|
541
426
|
parsedGroups.xmp = parsedXmpTags;
|
|
542
427
|
|
|
@@ -805,6 +690,14 @@ export function loadView(
|
|
|
805
690
|
mergeSteps.push({type: 'thumbnail'});
|
|
806
691
|
mergeSteps.push({type: 'fileType'});
|
|
807
692
|
|
|
693
|
+
if (expanded && includeOffsets) {
|
|
694
|
+
mergeSteps.push({
|
|
695
|
+
type: 'metadataRange',
|
|
696
|
+
metadataBlocks,
|
|
697
|
+
metadataTruncated: !!metadataTruncated,
|
|
698
|
+
});
|
|
699
|
+
}
|
|
700
|
+
|
|
808
701
|
if (!fileHasMetaData) {
|
|
809
702
|
throw new exifErrors.MetadataMissingError();
|
|
810
703
|
}
|
|
@@ -834,6 +727,7 @@ export function loadView(
|
|
|
834
727
|
tagFilter,
|
|
835
728
|
dataView,
|
|
836
729
|
tiffHeaderOffset,
|
|
730
|
+
exifDataView,
|
|
837
731
|
fileType,
|
|
838
732
|
pngTextChunks,
|
|
839
733
|
pngTextIsAsync,
|
|
@@ -853,6 +747,7 @@ export function loadView(
|
|
|
853
747
|
tagFilter,
|
|
854
748
|
dataView,
|
|
855
749
|
tiffHeaderOffset,
|
|
750
|
+
exifDataView,
|
|
856
751
|
fileType,
|
|
857
752
|
pngTextChunks,
|
|
858
753
|
pngTextIsAsync,
|
|
@@ -892,6 +787,18 @@ export function loadView(
|
|
|
892
787
|
}
|
|
893
788
|
}
|
|
894
789
|
|
|
790
|
+
function readExifTagsSafely(dataView, tiffHeaderOffset, includeUnknown, computed, tagFilter) {
|
|
791
|
+
try {
|
|
792
|
+
return Tags.read(dataView, tiffHeaderOffset, includeUnknown, computed, tagFilter);
|
|
793
|
+
} catch (error) {
|
|
794
|
+
// A malformed TIFF header (an out-of-bounds offset or an invalid byte
|
|
795
|
+
// order marker, e.g. from a HEIC/AVIF iloc that does not point at real
|
|
796
|
+
// Exif) must not abort the whole parse. Skip Exif instead, but keep the
|
|
797
|
+
// same {tags, byteOrder} shape so callers can destructure safely.
|
|
798
|
+
return {tags: {}, byteOrder: ByteOrder.BIG_ENDIAN};
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
|
|
895
802
|
function filterTagsForParse(groupKey, readTags, tagFilter) {
|
|
896
803
|
if (!tagFilter.isActive) {
|
|
897
804
|
return readTags;
|