Socket
Socket
Sign inDemoInstall

jimp

Package Overview
Dependencies
Maintainers
1
Versions
281
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jimp

An image processing library written entirely in JavaScript (i.e. zero external or native dependencies)


Version published
Weekly downloads
1.3M
decreased by-4.06%
Maintainers
1
Weekly downloads
 
Created

What is jimp?

Jimp is an image processing library for Node.js that allows for image manipulation and conversion in a variety of ways. It is written entirely in JavaScript and does not require any native dependencies, making it easy to install and use across different platforms.

What are jimp's main functionalities?

Image Manipulation

This code sample demonstrates how to read an image, resize it, change its quality, convert it to greyscale, and then save the edited image.

const Jimp = require('jimp');

// Read the image, resize it and change its quality
Jimp.read('path/to/image.jpg')
  .then(image => {
    return image
      .resize(256, 256) // resize
      .quality(60) // set JPEG quality
      .greyscale() // set greyscale
      .write('path/to/edited-image.jpg'); // save
  })
  .catch(err => {
    console.error(err);
  });

Color Manipulation

This code sample shows how to read an image and adjust its brightness before saving it.

const Jimp = require('jimp');

// Read the image and adjust brightness
Jimp.read('path/to/image.jpg')
  .then(image => {
    return image
      .brightness(0.5) // increase brightness by 50%
      .write('path/to/brighter-image.jpg'); // save
  })
  .catch(err => {
    console.error(err);
  });

Image Conversion

This code sample illustrates how to read an image in one format (JPG) and convert it to another format (PNG) before saving.

const Jimp = require('jimp');

// Read the image and convert it to PNG
Jimp.read('path/to/image.jpg')
  .then(image => {
    return image
      .write('path/to/image.png'); // convert and save as PNG
  })
  .catch(err => {
    console.error(err);
  });

Other packages similar to jimp

Keywords

FAQs

Package last updated on 18 Oct 2019

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