exifreader 4.44.1 → 4.45.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 +4 -4
- package/bin/parse-config.js +78 -0
- 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 +37 -8
- package/src/icc-tags.js +4 -2
- package/src/image-header-jpeg.js +11 -6
- package/src/jfif-tags.js +2 -1
- package/src/loadview-pipeline.js +9 -4
- package/src/mpf-tags.js +5 -2
- package/src/png-text-tags.js +2 -1
- package/src/tag-names.js +4 -4
- package/src/thumbnail.js +24 -5
- package/src/utils.js +7 -4
- package/src/xmp-tags.js +5 -2
- package/webpack.config.js +1 -53
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ You can try it out on the
|
|
|
27
27
|
| -----------------------|---------|---------|---------|---------|---------|---------------|--------------------|-----------|---------------|
|
|
28
28
|
| JPEG | **yes** | **yes** | **yes** | **yes** | **yes** | **some*** | **some**** | **yes** | **yes** |
|
|
29
29
|
| JPEG XL*** | **yes** | no | **yes** | no | no | no | **some**** | ??? | **yes** |
|
|
30
|
-
| TIFF | **yes** | **yes** | **yes** | **yes** | ??? | **some*** | **some**** |
|
|
30
|
+
| TIFF | **yes** | **yes** | **yes** | **yes** | ??? | **some*** | **some**** | **yes** | N/A |
|
|
31
31
|
| PNG | **yes** | **yes** | **yes** | **yes** | ??? | ??? | **some**** | no | **yes** |
|
|
32
32
|
| HEIC/HEIF | **yes** | no | **yes** | **yes** | ??? | ??? | **some**** | **yes** | no |
|
|
33
33
|
| AVIF | **yes** | no | **yes** | **yes** | ??? | ??? | **some**** | **yes** | no |
|
|
@@ -879,12 +879,12 @@ Possible modules to include or exclude:
|
|
|
879
879
|
| `file` | JPEG file details: image width, height etc. |
|
|
880
880
|
| `jfif` | JFIF details in JPEG files: resolution, thumbnail etc. |
|
|
881
881
|
| `png_file` | PNG file details: image width, height etc. |
|
|
882
|
-
| `exif` | Regular Exif tags. If excluded, will also exclude `
|
|
882
|
+
| `exif` | Regular Exif tags. If excluded, will also exclude `photoshop`, `maker_notes`, and `thumbnail`. For TIFF files, excluding this will also exclude IPTC, XMP, and ICC. |
|
|
883
883
|
| `iptc` | IPTC tags. |
|
|
884
884
|
| `xmp` | XMP tags. |
|
|
885
885
|
| `icc` | ICC color profile tags. |
|
|
886
|
-
| `mpf` | Multi-picture Format tags.
|
|
887
|
-
| `photoshop` | Photoshop tags.
|
|
886
|
+
| `mpf` | Multi-picture Format tags. Does not need `exif`. |
|
|
887
|
+
| `photoshop` | Photoshop tags. Needs `exif`. |
|
|
888
888
|
| `maker_notes` | Proprietary camera maker tags. Needs `exif`. |
|
|
889
889
|
| `thumbnail` | Thumbnail image. Needs `exif`. |
|
|
890
890
|
|
|
@@ -0,0 +1,78 @@
|
|
|
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
|
+
// A module listed here cannot produce anything without the module it maps to.
|
|
6
|
+
// The thumbnail is stored in the Exif metadata, in IFD1, maker notes and
|
|
7
|
+
// Photoshop tags are read from an Exif tag. MPF is not listed: it has its own
|
|
8
|
+
// JPEG segment and parses without the Exif module.
|
|
9
|
+
const MODULE_DEPENDENCIES = {
|
|
10
|
+
thumbnail: 'exif',
|
|
11
|
+
maker_notes: 'exif',
|
|
12
|
+
photoshop: 'exif'
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
module.exports = parseConfig;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Turn a custom build configuration into the module map the build uses.
|
|
19
|
+
*
|
|
20
|
+
* @param {{include?: object, exclude?: string[]}|false} config The build
|
|
21
|
+
* configuration as normalised by `getConfig()` in `webpack.config.js`, where
|
|
22
|
+
* `exclude` has already become an array of module names, or `false` when
|
|
23
|
+
* there is no configuration.
|
|
24
|
+
* @returns {object|false} A map from module name to `false`, `true`, or the
|
|
25
|
+
* array of tag names to keep, or `false` when there is no configuration and
|
|
26
|
+
* the full bundle should be built.
|
|
27
|
+
*/
|
|
28
|
+
function parseConfig({include: includesConfig, exclude: excludesConfig}) {
|
|
29
|
+
const modules = [
|
|
30
|
+
'file',
|
|
31
|
+
'jfif',
|
|
32
|
+
'png_file',
|
|
33
|
+
'exif',
|
|
34
|
+
'iptc',
|
|
35
|
+
'xmp',
|
|
36
|
+
'icc',
|
|
37
|
+
'photoshop',
|
|
38
|
+
'maker_notes',
|
|
39
|
+
'mpf',
|
|
40
|
+
'thumbnail',
|
|
41
|
+
'tiff',
|
|
42
|
+
'jpeg',
|
|
43
|
+
'png',
|
|
44
|
+
'heic',
|
|
45
|
+
'avif',
|
|
46
|
+
'jxl',
|
|
47
|
+
'webp',
|
|
48
|
+
'gif'
|
|
49
|
+
];
|
|
50
|
+
|
|
51
|
+
if (includesConfig) {
|
|
52
|
+
const includes = {};
|
|
53
|
+
for (const module of modules) {
|
|
54
|
+
includes[module] = includesConfig[module] || isNeededByAnIncludedModule(module, includesConfig);
|
|
55
|
+
}
|
|
56
|
+
return includes;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (excludesConfig) {
|
|
60
|
+
const includes = {};
|
|
61
|
+
for (const module of modules) {
|
|
62
|
+
const dependency = MODULE_DEPENDENCIES[module];
|
|
63
|
+
includes[module] =
|
|
64
|
+
!(
|
|
65
|
+
excludesConfig.includes(module)
|
|
66
|
+
|| (dependency && excludesConfig.includes(dependency))
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
return includes;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function isNeededByAnIncludedModule(module, includesConfig) {
|
|
76
|
+
return Object.keys(MODULE_DEPENDENCIES)
|
|
77
|
+
.some((dependent) => (MODULE_DEPENDENCIES[dependent] === module) && !!includesConfig[dependent]);
|
|
78
|
+
}
|