New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

node-js-image

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

node-js-image

Manipulate Images in Node.js

  • 0.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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

Keywords

FAQs

Package last updated on 25 Feb 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc