Image
Manipulate Images in Node.js
Installation
npm i node-js-image
How to Use
Read the Image Data
const Image = require("node-js-image")
const img = new Image().fromFile('my-image-file.jpg')
const img = new Image({fname: 'my-image-file.jpg'})
Process the Image Data
Currently available methods:
- blackwhite
- grayscale
- invert
- mask
- reduce
- rotate
Examples
rotate
Clockwise rotation by 90°
img.rotate()
img.rotate().rotate().rotate()
invert
Invert the colors
img.invert()
blackwhite
Reduce the colors to Black and White only
img.blackwhite()
Save the Image to File
img.toFile('output.jpg', 100)
Method Chaining
You can chain the methods
img.invert()
.blackwhite()
.rotate()
.toFile('output.jpg')