exifreader 4.23.5 → 4.23.7
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 +15 -9
- package/bin/TagFilterPlugin.js +11 -7
- package/bin/build.js +15 -12
- package/exif-reader.d.ts +25 -25
- package/package.json +8 -8
- package/webpack.config.js +1 -1
package/README.md
CHANGED
|
@@ -232,7 +232,7 @@ const tags = ExifReader.load(fileBuffer, {expanded: true});
|
|
|
232
232
|
|
|
233
233
|
If you're having trouble getting the GPS location, see [this comment and
|
|
234
234
|
thread](https://github.com/mattiasw/ExifReader/issues/177#issuecomment-1172228225)
|
|
235
|
-
for more details.
|
|
235
|
+
and the [GPS section below](#gps) for more details.
|
|
236
236
|
|
|
237
237
|
#### Grouping
|
|
238
238
|
|
|
@@ -288,10 +288,11 @@ be negative for values that are south of the equator, west of the IRM, or below
|
|
|
288
288
|
sealevel. These are often more convenient values for regular use. For some
|
|
289
289
|
elaboration or if you need the original values, see [Notes](#notes) below.
|
|
290
290
|
|
|
291
|
-
If you're having trouble getting the GPS values on Android and
|
|
292
|
-
`type="file"` input to upload the image, make sure you are
|
|
293
|
-
`accept`
|
|
294
|
-
strip the GPS
|
|
291
|
+
If you're having trouble getting the GPS values on Android (and possibly also
|
|
292
|
+
IOS) and are using a `type="file"` input to upload the image, make sure you are
|
|
293
|
+
**not** setting `accept="image/*"` on the input element. Apparently
|
|
294
|
+
setting the `accept` attribute to this value [will strip the GPS
|
|
295
|
+
values](https://github.com/mattiasw/ExifReader/issues/378#issuecomment-2302705983).
|
|
295
296
|
|
|
296
297
|
### Using the thumbnail
|
|
297
298
|
|
|
@@ -351,10 +352,10 @@ not the source code. That means it's not possible to use the ES module (from the
|
|
|
351
352
|
`src` folder) or any tree shaking to get the benefit of a custom build. Tree
|
|
352
353
|
shaking will actually have close to no effect at all here so don't rely on it.
|
|
353
354
|
|
|
354
|
-
This is for npm users that use the built file. To specify what
|
|
355
|
-
want you can either use include pattern (start with an empty
|
|
356
|
-
exclude pattern (start with full functionality and exclude).
|
|
357
|
-
pattern is set, excludes will not be used.
|
|
355
|
+
This is for npm and yarn users that use the built file. To specify what
|
|
356
|
+
functionality you want you can either use include pattern (start with an empty
|
|
357
|
+
set and include) or exclude pattern (start with full functionality and exclude).
|
|
358
|
+
If an include pattern is set, excludes will not be used.
|
|
358
359
|
|
|
359
360
|
For Exif and IPTC it's also possible to specify which tags you're interested in.
|
|
360
361
|
Those tag groups have huge dictionaries of tags and you may not be interested in
|
|
@@ -412,6 +413,11 @@ npm rebuild exifreader
|
|
|
412
413
|
```
|
|
413
414
|
|
|
414
415
|
With yarn 2+:
|
|
416
|
+
|
|
417
|
+
From my experience, you need a `node_modules` folder for the rebuild command to
|
|
418
|
+
work with yarn 2+. If you don't have it, run `yarn config set nodeLinker
|
|
419
|
+
node-modules` and then run `yarn`. Then you can try to rebuild:
|
|
420
|
+
|
|
415
421
|
```bash
|
|
416
422
|
yarn rebuild exifreader
|
|
417
423
|
```
|
package/bin/TagFilterPlugin.js
CHANGED
|
@@ -4,16 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
const modules = {
|
|
6
6
|
exif: [
|
|
7
|
-
'src
|
|
8
|
-
'src
|
|
9
|
-
'src
|
|
10
|
-
'src
|
|
7
|
+
'src[/\\\\]tag-names-0th-ifd.js',
|
|
8
|
+
'src[/\\\\]tag-names-exif-ifd.js',
|
|
9
|
+
'src[/\\\\]tag-names-gps-ifd.js',
|
|
10
|
+
'src[/\\\\]tag-names-interoperability-ifd.js'
|
|
11
11
|
],
|
|
12
12
|
iptc: [
|
|
13
|
-
'src
|
|
13
|
+
'src[/\\\\]iptc-tag-names.js'
|
|
14
14
|
],
|
|
15
15
|
mpf: [
|
|
16
|
-
'src
|
|
16
|
+
'src[/\\\\]tag-names-mpf-ifd.js'
|
|
17
17
|
]
|
|
18
18
|
};
|
|
19
19
|
|
|
@@ -70,10 +70,14 @@ module.exports = function TagFilter() {
|
|
|
70
70
|
function getFileModuleType(filename) {
|
|
71
71
|
for (const module in modules) {
|
|
72
72
|
for (const file of modules[module]) {
|
|
73
|
-
if (
|
|
73
|
+
if (endsWith(filename, file)) {
|
|
74
74
|
return module;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
return false;
|
|
79
79
|
}
|
|
80
|
+
|
|
81
|
+
function endsWith(string, suffix) {
|
|
82
|
+
return new RegExp(`${suffix}$`).test(string);
|
|
83
|
+
}
|
package/bin/build.js
CHANGED
|
@@ -7,28 +7,25 @@ const fs = require('fs');
|
|
|
7
7
|
const {execSync} = require('child_process');
|
|
8
8
|
const dependentHasExifReaderConfig = require('./findDependentConfig');
|
|
9
9
|
|
|
10
|
-
const WEBPACK_VERSION = '5.89.0';
|
|
11
|
-
const WEBPACK_CLI_VERSION = '5.1.4';
|
|
12
|
-
|
|
13
10
|
const EXIFREADER_ROOT_DIR = path.join(__dirname, '..');
|
|
14
11
|
process.chdir(EXIFREADER_ROOT_DIR);
|
|
15
12
|
|
|
16
13
|
if (!process.argv.includes('--only-with-config') || checkConfig()) {
|
|
17
|
-
execSync(`npx -p webpack-cli
|
|
14
|
+
execSync(`npx -p ${getPackage('webpack-cli')} -p ${getPackage('webpack')} webpack`, {stdio: 'inherit'});
|
|
18
15
|
}
|
|
19
16
|
|
|
20
17
|
function checkConfig() {
|
|
21
18
|
if (dependentHasExifReaderConfig()) {
|
|
22
19
|
console.log('Installing ExifReader custom build dependencies...'); // eslint-disable-line no-console
|
|
23
20
|
const packages = [
|
|
24
|
-
'@babel/core
|
|
25
|
-
'@babel/preset-env
|
|
26
|
-
'@babel/register
|
|
27
|
-
'babel-loader
|
|
28
|
-
'cross-env
|
|
29
|
-
'string-replace-loader
|
|
30
|
-
'terser-webpack-plugin
|
|
31
|
-
];
|
|
21
|
+
'@babel/core',
|
|
22
|
+
'@babel/preset-env',
|
|
23
|
+
'@babel/register',
|
|
24
|
+
'babel-loader',
|
|
25
|
+
'cross-env',
|
|
26
|
+
'string-replace-loader',
|
|
27
|
+
'terser-webpack-plugin'
|
|
28
|
+
].map((_package) => getPackage(_package));
|
|
32
29
|
const tmpDir = path.join(EXIFREADER_ROOT_DIR, '__tmp');
|
|
33
30
|
try {
|
|
34
31
|
initTmpDir(tmpDir);
|
|
@@ -36,6 +33,7 @@ function checkConfig() {
|
|
|
36
33
|
console.log('Done.'); // eslint-disable-line no-console
|
|
37
34
|
} catch (error) {
|
|
38
35
|
console.error('Could not install requirements for a custom build:', error); // eslint-disable-line no-console
|
|
36
|
+
process.exit(1);
|
|
39
37
|
} finally {
|
|
40
38
|
cleanUpTmpDir(tmpDir);
|
|
41
39
|
}
|
|
@@ -44,6 +42,11 @@ function checkConfig() {
|
|
|
44
42
|
return false;
|
|
45
43
|
}
|
|
46
44
|
|
|
45
|
+
function getPackage(name) {
|
|
46
|
+
const version = require(path.join(EXIFREADER_ROOT_DIR, 'package.json')).devDependencies[name].replace(/^\^/, '');
|
|
47
|
+
return `${name}@${version}`;
|
|
48
|
+
}
|
|
49
|
+
|
|
47
50
|
function initTmpDir(tmpDir) {
|
|
48
51
|
const nodeModulesDir = path.join(EXIFREADER_ROOT_DIR, 'node_modules');
|
|
49
52
|
fs.mkdirSync(tmpDir, {recursive: true});
|
package/exif-reader.d.ts
CHANGED
|
@@ -293,8 +293,8 @@ interface ExifTags {
|
|
|
293
293
|
'SamplesPerPixel'?: NumberTag,
|
|
294
294
|
'RowsPerStrip'?: NumberTag,
|
|
295
295
|
'StripByteCounts'?: NumberArrayTag,
|
|
296
|
-
'XResolution'?:
|
|
297
|
-
'YResolution'?:
|
|
296
|
+
'XResolution'?: RationalTag | NumberFileTag, // Also in JFIF tags.
|
|
297
|
+
'YResolution'?: RationalTag | NumberFileTag, // Also in JFIF tags.
|
|
298
298
|
'PlanarConfiguration'?: NumberTag,
|
|
299
299
|
'ResolutionUnit'?: NumberTag,
|
|
300
300
|
'TransferFunction'?: NumberArrayTag,
|
|
@@ -321,30 +321,30 @@ interface ExifTags {
|
|
|
321
321
|
'JFIF Thumbnail'?: JfifThumbnailTag,
|
|
322
322
|
|
|
323
323
|
// Exif tags
|
|
324
|
-
'ExposureTime'?:
|
|
325
|
-
'FNumber'?:
|
|
324
|
+
'ExposureTime'?: RationalTag,
|
|
325
|
+
'FNumber'?: RationalTag,
|
|
326
326
|
'ExposureProgram'?: NumberTag,
|
|
327
327
|
'SpectralSensitivity'?: StringArrayTag,
|
|
328
|
-
'ISOSpeedRatings'?: NumberTag
|
|
329
|
-
'OECF'?:
|
|
328
|
+
'ISOSpeedRatings'?: NumberTag | NumberArrayTag,
|
|
329
|
+
'OECF'?: unknown,
|
|
330
330
|
'ExifVersion'?: NumberArrayTag,
|
|
331
331
|
'DateTimeOriginal'?: StringArrayTag,
|
|
332
332
|
'DateTimeDigitized'?: StringArrayTag,
|
|
333
333
|
'ComponentsConfiguration'?: NumberArrayTag,
|
|
334
|
-
'CompressedBitsPerPixel'?:
|
|
335
|
-
'ShutterSpeedValue'?:
|
|
336
|
-
'ApertureValue'?:
|
|
337
|
-
'BrightnessValue'?:
|
|
338
|
-
'ExposureBiasValue'?:
|
|
339
|
-
'MaxApertureValue'?:
|
|
340
|
-
'SubjectDistance'?:
|
|
334
|
+
'CompressedBitsPerPixel'?: RationalTag,
|
|
335
|
+
'ShutterSpeedValue'?: RationalTag,
|
|
336
|
+
'ApertureValue'?: RationalTag,
|
|
337
|
+
'BrightnessValue'?: RationalTag,
|
|
338
|
+
'ExposureBiasValue'?: RationalTag,
|
|
339
|
+
'MaxApertureValue'?: RationalTag,
|
|
340
|
+
'SubjectDistance'?: RationalTag,
|
|
341
341
|
'MeteringMode'?: NumberTag,
|
|
342
342
|
'LightSource'?: NumberTag,
|
|
343
343
|
'Flash'?: NumberTag,
|
|
344
|
-
'FocalLength'?:
|
|
344
|
+
'FocalLength'?: RationalTag,
|
|
345
345
|
'SubjectArea'?: NumberArrayTag,
|
|
346
|
-
'MakerNote'?:
|
|
347
|
-
'UserComment'?:
|
|
346
|
+
'MakerNote'?: unknown,
|
|
347
|
+
'UserComment'?: unknown,
|
|
348
348
|
'SubSecTime'?: StringArrayTag,
|
|
349
349
|
'SubSecTimeOriginal'?: StringArrayTag,
|
|
350
350
|
'SubSecTimeDigitized'?: StringArrayTag,
|
|
@@ -355,27 +355,27 @@ interface ExifTags {
|
|
|
355
355
|
'RelatedSoundFile'?: StringArrayTag,
|
|
356
356
|
'Interoperability IFD Pointer'?: NumberTag,
|
|
357
357
|
'FlashEnergy'?: NumberTag,
|
|
358
|
-
'SpatialFrequencyResponse'?:
|
|
359
|
-
'FocalPlaneXResolution'?:
|
|
360
|
-
'FocalPlaneYResolution'?:
|
|
358
|
+
'SpatialFrequencyResponse'?: unknown,
|
|
359
|
+
'FocalPlaneXResolution'?: RationalTag,
|
|
360
|
+
'FocalPlaneYResolution'?: RationalTag,
|
|
361
361
|
'FocalPlaneResolutionUnit'?: NumberTag,
|
|
362
362
|
'SubjectLocation'?: NumberArrayTag,
|
|
363
|
-
'ExposureIndex'?:
|
|
363
|
+
'ExposureIndex'?: RationalTag,
|
|
364
364
|
'SensingMethod'?: NumberTag,
|
|
365
365
|
'FileSource'?: NumberTag,
|
|
366
366
|
'SceneType'?: NumberTag,
|
|
367
|
-
'CFAPattern'?:
|
|
367
|
+
'CFAPattern'?: unknown,
|
|
368
368
|
'CustomRendered'?: NumberTag,
|
|
369
369
|
'ExposureMode'?: NumberTag,
|
|
370
370
|
'WhiteBalance'?: NumberTag,
|
|
371
|
-
'DigitalZoomRatio'?:
|
|
371
|
+
'DigitalZoomRatio'?: RationalTag,
|
|
372
372
|
'FocalLengthIn35mmFilm'?: NumberTag,
|
|
373
373
|
'SceneCaptureType'?: NumberTag,
|
|
374
374
|
'GainControl'?: NumberTag,
|
|
375
375
|
'Contrast'?: NumberTag,
|
|
376
376
|
'Saturation'?: NumberTag,
|
|
377
377
|
'Sharpness'?: NumberTag,
|
|
378
|
-
'DeviceSettingDescription'?:
|
|
378
|
+
'DeviceSettingDescription'?: unknown,
|
|
379
379
|
'SubjectDistanceRange'?: NumberTag,
|
|
380
380
|
'ImageUniqueID'?: StringArrayTag,
|
|
381
381
|
'LensMake'?: StringArrayTag,
|
|
@@ -413,8 +413,8 @@ interface ExifTags {
|
|
|
413
413
|
'GPSDestBearing'?: NumberTag,
|
|
414
414
|
'GPSDestDistanceRef'?: StringArrayTag,
|
|
415
415
|
'GPSDestDistance'?: NumberTag,
|
|
416
|
-
'GPSProcessingMethod'?:
|
|
417
|
-
'GPSAreaInformation'?:
|
|
416
|
+
'GPSProcessingMethod'?: unknown,
|
|
417
|
+
'GPSAreaInformation'?: unknown,
|
|
418
418
|
'GPSDateStamp'?: StringArrayTag,
|
|
419
419
|
'GPSDifferential'?: NumberTag,
|
|
420
420
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "exifreader",
|
|
3
|
-
"version": "4.23.
|
|
3
|
+
"version": "4.23.7",
|
|
4
4
|
"description": "Library that parses Exif metadata in images.",
|
|
5
5
|
"author": "Mattias Wallander <mattias@wallander.eu>",
|
|
6
6
|
"repository": {
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"@xmldom/xmldom": "^0.8.10"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@babel/core": "^7.
|
|
29
|
-
"@babel/preset-env": "^7.
|
|
30
|
-
"@babel/register": "^7.
|
|
31
|
-
"@types/node": "^
|
|
32
|
-
"babel-loader": "^9.1
|
|
28
|
+
"@babel/core": "^7.25.2",
|
|
29
|
+
"@babel/preset-env": "^7.25.4",
|
|
30
|
+
"@babel/register": "^7.24.6",
|
|
31
|
+
"@types/node": "^20.16.10",
|
|
32
|
+
"babel-loader": "^9.2.1",
|
|
33
33
|
"babel-plugin-rewire": "^1.2.0",
|
|
34
34
|
"chai": "^4.3.10",
|
|
35
35
|
"cross-env": "^7.0.3",
|
|
@@ -42,8 +42,8 @@
|
|
|
42
42
|
"nyc": "^17.0.0",
|
|
43
43
|
"rimraf": "^5.0.5",
|
|
44
44
|
"string-replace-loader": "^3.1.0",
|
|
45
|
-
"terser-webpack-plugin": "^5.3.
|
|
46
|
-
"typescript": "^5.
|
|
45
|
+
"terser-webpack-plugin": "^5.3.10",
|
|
46
|
+
"typescript": "^5.6.2",
|
|
47
47
|
"webpack": "^5.89.0",
|
|
48
48
|
"webpack-cli": "^5.1.4",
|
|
49
49
|
"webpack-dev-server": "^5.0.4"
|
package/webpack.config.js
CHANGED
|
@@ -81,7 +81,7 @@ module.exports = {
|
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
83
|
{
|
|
84
|
-
test:
|
|
84
|
+
test: /[/\\](exif-reader|image-header-?(tiff|jpeg|png|heic|avif|iso-bmff|webp|gif)?|tags|tag-names)\.js$/,
|
|
85
85
|
loader: 'string-replace-loader',
|
|
86
86
|
options: {
|
|
87
87
|
multiple: getConstantReplacements(includedModules)
|