mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Allow withMetadata to set density #967
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user