Docs: rebuild to include commit 6979042

This commit is contained in:
Lovell Fuller 2021-07-19 15:30:01 +01:00
parent 69790421b7
commit 2afec9e3ed

View File

@ -77,6 +77,9 @@ A `Promise` is returned when `callback` is not provided.
* `sharpness`: Estimation of greyscale sharpness based on the standard deviation of a Laplacian convolution, discarding alpha channel if any (experimental) * `sharpness`: Estimation of greyscale sharpness based on the standard deviation of a Laplacian convolution, discarding alpha channel if any (experimental)
* `dominant`: Object containing most dominant sRGB colour based on a 4096-bin 3D histogram (experimental) * `dominant`: Object containing most dominant sRGB colour based on a 4096-bin 3D histogram (experimental)
**Note**: Statistics are derived from the original input image. Any operations performed on the image must first be
written to a buffer in order to run `stats` on the result (see third example).
### Parameters ### Parameters
* `callback` **[Function][4]?** called with the arguments `(err, stats)` * `callback` **[Function][4]?** called with the arguments `(err, stats)`
@ -97,6 +100,14 @@ const { entropy, sharpness, dominant } = await sharp(input).stats();
const { r, g, b } = dominant; const { r, g, b } = dominant;
``` ```
```javascript
const image = sharp(input);
// store intermediate result
const part = await image.extract(region).toBuffer();
// create new instance to obtain statistics of extracted region
const stats = await sharp(part).stats();
```
Returns **[Promise][5]<[Object][6]>** Returns **[Promise][5]<[Object][6]>**
[1]: https://libvips.github.io/libvips/API/current/VipsImage.html#VipsInterpretation [1]: https://libvips.github.io/libvips/API/current/VipsImage.html#VipsInterpretation