diff --git a/docs/api.md b/docs/api.md index f4bd9915..5c825332 100644 --- a/docs/api.md +++ b/docs/api.md @@ -393,11 +393,11 @@ When a `sigma` is provided, performs a slower, more accurate sharpen of the L ch #### threshold([threshold], [options]) -Converts all pixels in the image to greyscale white or black. Any pixel greather-than-or-equal-to the threshold (0..255) will be white. All others will be black. +Any pixel value greather than or equal to the threshold value will be set to 255, otherwise it will be set to 0. +By default, the image will be converted to single channel greyscale before thresholding. -* `threshold`, if present, is a Number, representing the level above which pixels will be forced to white. - -* `options`, an options object that may contain a boolean `grayscale` or `greyscale`. When `grayscale` is `true`, `threshold` returns a black and white image, and when `false` a color image with each channel thresholded independently. The default is `grayscale: true` when omitted. +* `threshold`, if present, is a Number between 0 and 255, representing the level at which the threshold will be applied. The default threshold is 128. +* `options`, if present, is an Object containing a Boolean `greyscale` (or `grayscale`). When `false` each channel will have the threshold applied independently. #### gamma([gamma]) diff --git a/docs/changelog.md b/docs/changelog.md index dab51843..e5da75dd 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -30,6 +30,10 @@ Requires libvips v8.3.1 [#456](https://github.com/lovell/sharp/pull/456) [@kapouer](https://github.com/kapouer) +* Add greyscale option to threshold operation for colourspace conversion control. + [#480](https://github.com/lovell/sharp/pull/480) + [@mhirsch](https://github.com/mhirsch) + * Ensure ICC profiles are licenced for distribution. [#486](https://github.com/lovell/sharp/issues/486) [@kapouer](https://github.com/kapouer) diff --git a/docs/index.md b/docs/index.md index f6e6855a..9c753ab8 100644 --- a/docs/index.md +++ b/docs/index.md @@ -94,6 +94,8 @@ the help and code contributions of the following people: * [Samy Al Zahrani](https://github.com/salzhrani) * [Chintan Thakkar](https://github.com/lemnisk8) * [F. Orlando Galashan](https://github.com/frulo) +* [Kleis Auke Wolthuizen](https://github.com/kleisauke) +* [Matt Hirsch](https://github.com/mhirsch) Thank you! diff --git a/package.json b/package.json index d988a5db..61dd04c4 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,8 @@ "Samy Al Zahrani ", "Chintan Thakkar ", "F. Orlando Galashan ", - "Kleis Auke Wolthuizen " + "Kleis Auke Wolthuizen ", + "Matt Hirsch " ], "description": "High performance Node.js image processing, the fastest module to resize JPEG, PNG, WebP and TIFF images", "scripts": {