Allow withMetadata to set density #967

This commit is contained in:
Lovell Fuller
2021-04-17 13:46:54 +01:00
parent 8c0c01c702
commit 4237f5520f
9 changed files with 85 additions and 6 deletions

View File

@@ -120,6 +120,7 @@ sRGB colour space and strip all metadata, including the removal of any ICC profi
- `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 `{}`)
- `options.density` **[number][9]?** Number of pixels per inch (DPI).
### Examples
@@ -132,7 +133,7 @@ sharp('input.jpg')
```javascript
// Set "IFD0-Copyright" in output EXIF metadata
await sharp(input)
const data = await sharp(input)
.withMetadata({
exif: {
IFD0: {
@@ -141,6 +142,12 @@ await sharp(input)
}
})
.toBuffer();
* @example
// Set output metadata to 96 DPI
const data = await sharp(input)
.withMetadata({ density: 96 })
.toBuffer();
```
- Throws **[Error][4]** Invalid parameters

View File

@@ -6,6 +6,9 @@ Requires libvips v8.10.6
### v0.28.2 - TBD
* Allow `withMetadata` to set `density`.
[#967](https://github.com/lovell/sharp/issues/967)
* Skip shrink-on-load where one dimension <4px.
[#2653](https://github.com/lovell/sharp/issues/2653)