Add experimental sharpness calc to stats #2251

This commit is contained in:
Lovell Fuller
2020-06-12 11:25:57 +01:00
parent 9431029917
commit 8f5495a446
6 changed files with 49 additions and 2 deletions

View File

@@ -299,6 +299,7 @@ function metadata (callback) {
* - `maxY` (y-coordinate of one of the pixel where the maximum lies)
* - `isOpaque`: Is the image fully opaque? Will be `true` if the image has no alpha channel or if every pixel is fully opaque.
* - `entropy`: Histogram-based estimation of greyscale entropy, 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)
*
* @example
* const image = sharp(inputJpg);
@@ -308,6 +309,9 @@ function metadata (callback) {
* // stats contains the channel-wise statistics array and the isOpaque value
* });
*
* @example
* const { entropy, sharpness } = await sharp(input).stats();
*
* @param {Function} [callback] - called with the arguments `(err, stats)`
* @returns {Promise<Object>}
*/