Skip to content

LinusU/threshold-image-data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 pixels
  • height: Number - The height of the image, in pixels
  • data: Buffer | TypedArray - The image data, stored as raw pixel data in the RGBA order

The image will be modified in-place.

Related

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors