Apply black/white threshold to a decoded raw image, using the Rec. 709 luma algorithm.
Should match ImageMagick's threshold operation.
npm install --save threshold-image-dataconst thresholdImageData = require('threshold-image-data')
// Modifies the image in-place
thresholdImageData(image, 0.5)Apply the threshold to the image.
The image argument should be a ImageData instance, or any object with the following properties:
width: Number- The width of the image, in pixelsheight: Number- The height of the image, in pixelsdata: Buffer | TypedArray- The image data, stored as raw pixel data in the RGBA order
The image will be modified in-place.
resize-image-data- Resize a decoded raw imagerotate-image-data- Rotate a decoded raw image