0.1.0 • Published 2 years ago
threshold-image-data v0.1.0
Threshold Image Data
Apply black/white threshold to a decoded raw image, using the Rec. 709 luma algorithm.
Should match ImageMagick's threshold
operation.
Installation
npm install --save threshold-image-data
Usage
const thresholdImageData = require('threshold-image-data')
// Modifies the image in-place
thresholdImageData(image, 0.5)
API
thresholdImageData(image, threshold)
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.
Related
resize-image-data
- Resize a decoded raw imagerotate-image-data
- Rotate a decoded raw image
0.1.0
2 years ago