Allow EXIF metadata to be set/update #650

This commit is contained in:
Lovell Fuller
2021-04-05 11:39:53 +01:00
parent 43a085d1ae
commit bc60daff9e
9 changed files with 108 additions and 1 deletions

View File

@@ -119,6 +119,7 @@ sRGB colour space and strip all metadata, including the removal of any ICC profi
- `options` **[Object][6]?**
- `options.orientation` **[number][9]?** value between 1 and 8, used to update the EXIF `Orientation` tag.
- `options.icc` **[string][2]?** filesystem path to output ICC profile, defaults to sRGB.
- `options.exif` **[Object][6]<[Object][6]>** Object keyed by IFD0, IFD1 etc. of key/value string pairs to write as EXIF data. (optional, default `{}`)
### Examples
@@ -129,6 +130,19 @@ sharp('input.jpg')
.then(info => { ... });
```
```javascript
// Set "IFD0-Copyright" in output EXIF metadata
await sharp(input)
.withMetadata({
exif: {
IFD0: {
Copyright: 'Wernham Hogg'
}
}
})
.toBuffer();
```
- Throws **[Error][4]** Invalid parameters
Returns **Sharp**

View File

@@ -8,6 +8,9 @@ Requires libvips v8.10.6
* Ensure all installation errors are logged with a more obvious prefix.
* Allow `withMetadata` to set and update EXIF metadata.
[#650](https://github.com/lovell/sharp/issues/650)
* Add support for OME-TIFF Sub Image File Directories (subIFD).
[#2557](https://github.com/lovell/sharp/issues/2557)