0.0.6 • Published 3 years ago

node-js-image v0.0.6

Weekly downloads
242
License
MIT
Repository
github
Last release
3 years ago

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")

// read image from a file
const img = new Image().fromFile('my-image-file.jpg')

// or as a shortcut
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°

// 90° clock-wise
img.rotate()

// chain the rotate() method
// 270 °clock-wise
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

// filepath, quality (0-100)
img.toFile('output.jpg', 100)

Method Chaining

You can chain the methods

img.invert()
  .blackwhite()
  .rotate()
  .toFile('output.jpg')
0.0.3

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.6

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago