exifreader 4.25.0 → 4.26.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "exifreader",
3
- "version": "4.25.0",
3
+ "version": "4.26.0",
4
4
  "description": "Library that parses Exif metadata in images.",
5
5
  "author": "Mattias Wallander <mattias@wallander.eu>",
6
6
  "repository": {
@@ -37,14 +37,14 @@
37
37
  "eslint": "^8.52.0",
38
38
  "eslint-plugin-cypress": "^3.0.2",
39
39
  "husky": "^9.0.11",
40
- "mocha": "^10.2.0",
40
+ "mocha": "^11.0.1",
41
41
  "npm-run-all": "^4.1.5",
42
42
  "nyc": "^17.0.0",
43
43
  "rimraf": "^5.0.5",
44
44
  "string-replace-loader": "^3.1.0",
45
45
  "terser-webpack-plugin": "^5.3.10",
46
46
  "typescript": "^5.6.2",
47
- "webpack": "^5.89.0",
47
+ "webpack": "5.97.1",
48
48
  "webpack-cli": "^5.1.4",
49
49
  "webpack-dev-server": "^5.0.4"
50
50
  },
package/src/canon-tags.js CHANGED
@@ -3,6 +3,8 @@
3
3
  * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
4
 
5
5
  // Reverse-engineered docs:
6
+ // https://exiftool.org/makernote_types.html
7
+ // https://exiv2.org/makernote.html
6
8
  // https://exiv2.org/tags-canon.html
7
9
  // https://gist.github.com/redaktor/bae0ef2377ab70bc5276
8
10
  // https://www.ozhiker.com/electronics/pjmt/jpeg_info/canon_mn.html
@@ -230,11 +230,26 @@ export default {
230
230
  0x87b0: 'GeoTiffDoubleParams',
231
231
  0x87b1: 'GeoTiffAsciiParams',
232
232
  0x8825: 'GPS Info IFD Pointer',
233
- 0x9c9b: 'XPTitle',
234
- 0x9c9c: 'XPComment',
235
- 0x9c9d: 'XPAuthor',
236
- 0x9c9e: 'XPKeywords',
237
- 0x9c9f: 'XPSubject',
233
+ 0x9c9b: {
234
+ name: 'XPTitle',
235
+ description: decodeXPValue,
236
+ },
237
+ 0x9c9c: {
238
+ name: 'XPComment',
239
+ description: decodeXPValue
240
+ },
241
+ 0x9c9d: {
242
+ name: 'XPAuthor',
243
+ description: decodeXPValue,
244
+ },
245
+ 0x9c9e: {
246
+ name: 'XPKeywords',
247
+ description: decodeXPValue,
248
+ },
249
+ 0x9c9f: {
250
+ name: 'XPSubject',
251
+ description: decodeXPValue,
252
+ },
238
253
  0xa480: 'GDALMetadata',
239
254
  0xa481: 'GDALNoData',
240
255
  0xc4a5: 'PrintIM',
@@ -355,3 +370,12 @@ export default {
355
370
  0xc7a7: 'NewRawImageDigest',
356
371
  0xc7a8: 'RawToPreviewGain'
357
372
  };
373
+
374
+ function decodeXPValue(value) {
375
+ // The XP tags are encoded as UCS-2 which uses two bytes per character but
376
+ // it's close to UTF-16 so we can use that to decode them.
377
+ // https://www.loc.gov/preservation/digital/formats/content/tiff_tags.shtml
378
+ const decodedValue = new TextDecoder('utf-16').decode(new Uint8Array(value));
379
+ // Some softwares pad the string with null characters so we remove them.
380
+ return decodedValue.replace(/\u0000+$/, ''); // eslint-disable-line no-control-regex
381
+ }