exifreader 4.37.1 → 4.38.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 CHANGED
@@ -3,8 +3,9 @@ ExifReader
3
3
 
4
4
  ExifReader is a JavaScript library that parses image files and extracts the
5
5
  metadata. It can also extract an embedded thumbnail. It can be used either in a
6
- browser or from Node. Supports JPEG, TIFF, PNG, HEIC, AVIF, WebP, and GIF files
7
- with Exif, IPTC, XMP, ICC, MPF, and more metadata (depending on file type).
6
+ browser or from Node. Supports JPEG, JPEG XL, TIFF, PNG, HEIC, AVIF, WebP, and
7
+ GIF files with Exif, IPTC, XMP, ICC, MPF, and more metadata (depending on file
8
+ type).
8
9
 
9
10
  ExifReader is highly and easily configurable and the resulting bundle can be as
10
11
  small as **~4 KiB** (gzipped) if you're only interested in a few tags (e.g. date
@@ -18,21 +19,21 @@ You can try it out on the
18
19
 
19
20
  **Support table**
20
21
 
21
- | File type | Exif | IPTC | XMP | ICC | MPF | Photoshop | MakerNote | Thumbnail | Image details |
22
- | ----------|---------|---------|---------|---------|---------|---------------|--------------------|-----------|---------------|
23
- | JPEG | **yes** | **yes** | **yes** | **yes** | **yes** | **some*** | **some**** | **yes** | **yes** |
24
- | TIFF | **yes** | **yes** | **yes** | **yes** | ??? | **some*** | **some**** | N/A | N/A |
25
- | PNG | **yes** | **yes** | **yes** | **yes** | ??? | ??? | **some**** | no | **yes** |
26
- | HEIC/HEIF | **yes** | no | **yes** | **yes** | ??? | ??? | **some**** | **yes** | no |
27
- | AVIF | **yes** | no | **yes** | **yes** | ??? | ??? | **some**** | **yes** | no |
28
- | WebP | **yes** | no | **yes** | **yes** | ??? | ??? | **some**** | **yes** | **yes** |
29
- | GIF | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | **yes** |
22
+ | File type | Exif | IPTC | XMP | ICC | MPF | Photoshop | MakerNote | Thumbnail | Image details |
23
+ | -----------------------|---------|---------|---------|---------|---------|---------------|--------------------|-----------|---------------|
24
+ | JPEG | **yes** | **yes** | **yes** | **yes** | **yes** | **some*** | **some**** | **yes** | **yes** |
25
+ | JPEG XL*** | **yes** | no | **yes** | no | no | no | **some**** | ??? | **yes** |
26
+ | TIFF | **yes** | **yes** | **yes** | **yes** | ??? | **some*** | **some**** | N/A | N/A |
27
+ | PNG | **yes** | **yes** | **yes** | **yes** | ??? | ??? | **some**** | no | **yes** |
28
+ | HEIC/HEIF | **yes** | no | **yes** | **yes** | ??? | ??? | **some**** | **yes** | no |
29
+ | AVIF | **yes** | no | **yes** | **yes** | ??? | ??? | **some**** | **yes** | no |
30
+ | WebP | **yes** | no | **yes** | **yes** | ??? | ??? | **some**** | **yes** | **yes** |
31
+ | GIF | N/A | N/A | N/A | N/A | N/A | N/A | N/A | N/A | **yes** |
30
32
 
31
33
  - `MakerNote` = Manufacturers' proprietary MakerNote tags.
32
34
  - `Image details` = image width, height, etc. read from image header.
33
35
  - `N/A` = The feature is not applicable to this file type.
34
- - `???` = may be supported in any file type using Exif but it has only been tested
35
- on JPEGs.
36
+ - `???` = may be supported but has not been tested.
36
37
  - `*` = A draft implementation of Photoshop tags have been added with
37
38
  `ClippingPathName` and `PathInformation` currently supported. Photoshop tags
38
39
  are very different from other tags and need a lot of extra code so they have
@@ -40,6 +41,10 @@ You can try it out on the
40
41
  you think should really be supported.
41
42
  - `**` = Some of the Canon-specific and Pentax-specific tags have been added.
42
43
  File an issue if you think something more should be supported.
44
+ - `***` = Metadata in JPEG XL are often (but not always) encoded with Brotli
45
+ compression. This is supported in some environments when using
46
+ `async: true`. See the [Asynchronous tags](#asynchronous-tags) and
47
+ [Custom decompression](#custom-decompression) sections for details.
43
48
 
44
49
  If you're missing something that you think should be supported, file an issue
45
50
  with an attached example image and I'll see what I can do.
@@ -195,9 +200,10 @@ directions on how to use the library.
195
200
  #### Asynchronous tags
196
201
 
197
202
  Some tags need to be parsed asynchronously. Currently this is the case for some
198
- PNG tags, more specifically compressed tags in zTXt, iTXt, and iCCP chunks. To
199
- enable this, either use the asynchronous API mentioned above or pass in `async:
200
- true` in the options parameter:
203
+ PNG tags (compressed tags in zTXt, iTXt, and iCCP chunks) and JPEG XL files with
204
+ Brotli-compressed metadata (very common). To enable this, either use the
205
+ asynchronous API mentioned above or pass in `async: true` in the options
206
+ parameter:
201
207
 
202
208
  ```javascript
203
209
  const tags = await ExifReader.load(file);
@@ -205,11 +211,60 @@ const tags = await ExifReader.load(file);
205
211
  const tags = await ExifReader.load(fileBuffer, {async: true});
206
212
  ```
207
213
 
208
- For the compressed tags to work, the environment needs to support the
214
+ For the compressed PNG tags to work, the environment needs to support the
209
215
  [Compression Streams API](https://developer.mozilla.org/en-US/docs/Web/API/Compression_Streams_API#browser_compatibility).
216
+ Most modern browsers support deflate decompression through this API.
210
217
 
211
- The reason for having an option to enable this is to not break backwards
212
- compatibility. This will probably be the default in the next major version.
218
+ For JPEG XL Brotli decompression, Firefox, Safari, and Node.js have built-in
219
+ support through the Compression Streams API. Chrome does not currently support
220
+ Brotli in its Compression Streams API (April 2026). For environments without
221
+ built-in Brotli support, you can provide a custom decompression function via the
222
+ `decompress` option (see below).
223
+
224
+ The reason for having an option to enable asynchronous parsing is to not break
225
+ backwards compatibility. This will probably be the default in the next major
226
+ version.
227
+
228
+ #### Custom decompression
229
+
230
+ You can provide custom decompression functions for Brotli and/or deflate via the
231
+ `decompress` option. This is useful for JPEG XL files with Brotli-compressed
232
+ metadata in environments that don't have built-in Brotli support (e.g. Chrome),
233
+ or to override the built-in deflate decompression for PNG files. The custom
234
+ functions take a `Uint8Array` of compressed data and should return a
235
+ `Uint8Array` or `ArrayBuffer` with the decompressed data (or a `Promise` that
236
+ resolves to one).
237
+
238
+ ```javascript
239
+ const tags = await ExifReader.load(file, {
240
+ async: true,
241
+ decompress: {
242
+ brotli: async (compressedData) => myBrotliDecompress(compressedData),
243
+ }
244
+ });
245
+ ```
246
+
247
+ If a custom function is provided for a compression type, it takes priority over
248
+ the built-in Compression Streams API. If not provided, the library falls back to
249
+ the Compression Streams API when available.
250
+
251
+ A lightweight browser-compatible Brotli decompression library is
252
+ [brotli-dec-wasm](https://www.npmjs.com/package/brotli-dec-wasm), though it is
253
+ not widely used. A more popular alternative is
254
+ [brotli-wasm](https://www.npmjs.com/package/brotli-wasm), but it's also
255
+ larger:
256
+
257
+ ```javascript
258
+ import brotliPromise from 'brotli-wasm';
259
+ const brotli = await brotliPromise;
260
+
261
+ const tags = await ExifReader.load(file, {
262
+ async: true,
263
+ decompress: {
264
+ brotli: async (data) => brotli.decompress(data),
265
+ }
266
+ });
267
+ ```
213
268
 
214
269
  #### Grouping
215
270
 
@@ -600,6 +655,7 @@ Possible modules to include or exclude:
600
655
  | `png` | PNG images. |
601
656
  | `heic` | HEIC/HEIF images. |
602
657
  | `webp` | WebP images. |
658
+ | `jxl` | JPEG XL images. |
603
659
  | `gif` | GIF images. |
604
660
  | `file` | JPEG file details: image width, height etc. |
605
661
  | `jfif` | JFIF details in JPEG files: resolution, thumbnail etc. |
@@ -712,6 +768,8 @@ Changelog
712
768
 
713
769
  A selection of notable changes.
714
770
 
771
+ - **April 2026**:
772
+ - Add support for JPEG XL images.
715
773
  - **January 2026**:
716
774
  - Add `includeTags` / `excludeTags` options for filtering returned tags by
717
775
  group and tag name/ID.