exifreader 4.34.0 → 4.36.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 +88 -0
- package/dist/exif-reader.js +1 -1
- package/dist/exif-reader.js.map +1 -1
- package/exif-reader.d.ts +56 -3
- package/package.json +7 -5
- package/src/canon-tags.js +20 -2
- package/src/exif-reader.js +617 -220
- package/src/image-header-jpeg.js +135 -1
- package/src/image-header-tiff.js +1 -3
- package/src/iptc-tags.js +56 -6
- package/src/loadview-pipeline.js +417 -0
- package/src/mpf-tags.js +10 -2
- package/src/pentax-tags.js +11 -2
- package/src/photoshop-tags.js +24 -1
- package/src/png-text-tags.js +28 -4
- package/src/tag-filter-config.js +124 -0
- package/src/tag-filter.js +409 -0
- package/src/tags-helpers.js +71 -18
- package/src/tags.js +29 -13
- package/src/tiff-constants.js +25 -0
- package/webpack.config.js +3 -0
package/exif-reader.d.ts
CHANGED
|
@@ -3,8 +3,33 @@
|
|
|
3
3
|
|
|
4
4
|
export as namespace ExifReader;
|
|
5
5
|
|
|
6
|
+
type FileTypeValue =
|
|
7
|
+
| 'tiff'
|
|
8
|
+
| 'jpeg'
|
|
9
|
+
| 'png'
|
|
10
|
+
| 'heic'
|
|
11
|
+
| 'avif'
|
|
12
|
+
| 'webp'
|
|
13
|
+
| 'gif'
|
|
14
|
+
| 'xml';
|
|
15
|
+
|
|
16
|
+
type FileTypeDescription =
|
|
17
|
+
| 'TIFF'
|
|
18
|
+
| 'JPEG'
|
|
19
|
+
| 'PNG'
|
|
20
|
+
| 'HEIC'
|
|
21
|
+
| 'AVIF'
|
|
22
|
+
| 'WebP'
|
|
23
|
+
| 'GIF'
|
|
24
|
+
| 'XML';
|
|
25
|
+
|
|
26
|
+
interface FileTypeTag {
|
|
27
|
+
value: FileTypeValue,
|
|
28
|
+
description: FileTypeDescription
|
|
29
|
+
}
|
|
30
|
+
|
|
6
31
|
interface FileTags {
|
|
7
|
-
'FileType'?:
|
|
32
|
+
'FileType'?: FileTypeTag,
|
|
8
33
|
'Bits Per Sample'?: NumberFileTag,
|
|
9
34
|
'Image Height'?: NumberFileTag,
|
|
10
35
|
'Image Width'?: NumberFileTag,
|
|
@@ -309,10 +334,38 @@ interface XmlDomParser {
|
|
|
309
334
|
parseFromString(xml: string, mimeType: string): unknown;
|
|
310
335
|
}
|
|
311
336
|
|
|
337
|
+
type TagSelectorWithId = string | number;
|
|
338
|
+
type TagSelectorNameOnly = string;
|
|
339
|
+
|
|
340
|
+
type TagFilterGroupWithId = true | TagSelectorWithId[];
|
|
341
|
+
type TagFilterGroupNameOnly = true | TagSelectorNameOnly[];
|
|
342
|
+
|
|
343
|
+
export type IncludeTagsOptions = {
|
|
344
|
+
exif?: TagFilterGroupWithId,
|
|
345
|
+
iptc?: TagFilterGroupWithId,
|
|
346
|
+
xmp?: TagFilterGroupNameOnly,
|
|
347
|
+
icc?: TagFilterGroupNameOnly,
|
|
348
|
+
photoshop?: TagFilterGroupWithId,
|
|
349
|
+
makerNotes?: TagFilterGroupWithId,
|
|
350
|
+
mpf?: TagFilterGroupWithId,
|
|
351
|
+
file?: TagFilterGroupNameOnly,
|
|
352
|
+
jfif?: TagFilterGroupNameOnly,
|
|
353
|
+
png?: TagFilterGroupNameOnly,
|
|
354
|
+
riff?: TagFilterGroupNameOnly,
|
|
355
|
+
gif?: TagFilterGroupNameOnly,
|
|
356
|
+
gps?: TagFilterGroupNameOnly,
|
|
357
|
+
composite?: TagFilterGroupNameOnly,
|
|
358
|
+
thumbnail?: TagFilterGroupNameOnly,
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
export type ExcludeTagsOptions = IncludeTagsOptions;
|
|
362
|
+
|
|
312
363
|
type CommonOptions = {
|
|
313
364
|
includeUnknown?: boolean,
|
|
314
365
|
computed?: boolean,
|
|
315
|
-
domParser?: XmlDomParser
|
|
366
|
+
domParser?: XmlDomParser,
|
|
367
|
+
includeTags?: IncludeTagsOptions,
|
|
368
|
+
excludeTags?: ExcludeTagsOptions,
|
|
316
369
|
};
|
|
317
370
|
|
|
318
371
|
export function load(data: ArrayBuffer | SharedArrayBuffer | Buffer): Tags;
|
|
@@ -582,7 +635,7 @@ interface IccTags {
|
|
|
582
635
|
[name: string]: ValueTag;
|
|
583
636
|
}
|
|
584
637
|
|
|
585
|
-
export type Tags = XmpTags & IccTags & PngTags & RiffTags & GifTags & PhotoshopTags & CanonTags & PentaxTags & CompositeTags & {
|
|
638
|
+
export type Tags = FileTags & XmpTags & IccTags & PngTags & RiffTags & GifTags & PhotoshopTags & CanonTags & PentaxTags & CompositeTags & {
|
|
586
639
|
'Thumbnail'?: ThumbnailTags;
|
|
587
640
|
'Images'?: MPFImageTags[],
|
|
588
641
|
} & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "exifreader",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.36.0",
|
|
4
4
|
"description": "Library that parses Exif metadata in images.",
|
|
5
5
|
"author": "Mattias Wallander <mattias@wallander.eu>",
|
|
6
6
|
"repository": {
|
|
@@ -57,22 +57,24 @@
|
|
|
57
57
|
"lint": "eslint .",
|
|
58
58
|
"start": "cross-env NODE_ENV=development webpack serve",
|
|
59
59
|
"test": "cross-env BABEL_ENV=test mocha --require @babel/register --recursive \"test/unit/\"",
|
|
60
|
+
"test:integration": "cross-env BABEL_ENV=test mocha --require @babel/register \"test/integration/**/*-spec.js\"",
|
|
61
|
+
"test:integration:update": "node test/integration/update.js",
|
|
60
62
|
"test:build": "mocha test/build/test.js",
|
|
61
63
|
"test:build:custom": "mocha --bail test/build/test-custom.js",
|
|
62
64
|
"test:build:update": "node test/build/update.js",
|
|
63
65
|
"test:e2e": "cypress run",
|
|
64
66
|
"test:types": "tsc --noEmit --project test/types",
|
|
65
|
-
"test:all": "npm-run-all lint test:types coverage test:e2e test:build test:build:custom",
|
|
67
|
+
"test:all": "npm-run-all lint test:types coverage test:e2e test:integration test:build test:build:custom",
|
|
66
68
|
"pre-commit": "npm-run-all lint test:types coverage test:build",
|
|
67
69
|
"postinstall": "node bin/build.js --only-with-config",
|
|
68
70
|
"prepare": "husky"
|
|
69
71
|
},
|
|
70
72
|
"nyc": {
|
|
71
73
|
"check-coverage": true,
|
|
72
|
-
"statements":
|
|
73
|
-
"branches":
|
|
74
|
+
"statements": 92,
|
|
75
|
+
"branches": 86,
|
|
74
76
|
"functions": 97,
|
|
75
|
-
"lines":
|
|
77
|
+
"lines": 92,
|
|
76
78
|
"reporter": [
|
|
77
79
|
"lcov",
|
|
78
80
|
"text"
|
package/src/canon-tags.js
CHANGED
|
@@ -20,8 +20,26 @@ export default {
|
|
|
20
20
|
SHOT_INFO_AUTO_ROTATE
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
function read(
|
|
24
|
-
|
|
23
|
+
function read(
|
|
24
|
+
dataView,
|
|
25
|
+
tiffHeaderOffset,
|
|
26
|
+
offset,
|
|
27
|
+
byteOrder,
|
|
28
|
+
includeUnknown,
|
|
29
|
+
computed = false,
|
|
30
|
+
tagFilter = undefined
|
|
31
|
+
) {
|
|
32
|
+
let tags = readIfd(
|
|
33
|
+
dataView,
|
|
34
|
+
IFD_TYPE_CANON,
|
|
35
|
+
tiffHeaderOffset,
|
|
36
|
+
tiffHeaderOffset + offset,
|
|
37
|
+
byteOrder,
|
|
38
|
+
includeUnknown,
|
|
39
|
+
computed,
|
|
40
|
+
tagFilter,
|
|
41
|
+
'makerNotes'
|
|
42
|
+
);
|
|
25
43
|
|
|
26
44
|
if (tags['ShotInfo']) {
|
|
27
45
|
tags = objectAssign({}, tags, parseShotInfo(tags['ShotInfo'].value));
|