Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jimp/plugin-resize

Package Overview
Dependencies
Maintainers
2
Versions
240
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jimp/plugin-resize

Resize an image.

  • 0.13.0
  • npm
  • Socket score

Version published
Weekly downloads
1.3M
increased by2.26%
Maintainers
2
Weekly downloads
 
Created

What is @jimp/plugin-resize?

@jimp/plugin-resize is a plugin for the Jimp image processing library that provides functionality for resizing images. It allows you to scale images up or down, fit them within specific dimensions, and apply various resizing algorithms.

What are @jimp/plugin-resize's main functionalities?

Resize to specific dimensions

This feature allows you to resize an image to specific dimensions. In this example, the image is resized to 256x256 pixels.

const Jimp = require('jimp');

Jimp.read('path/to/image.jpg')
  .then(image => {
    return image.resize(256, 256) // resize to 256x256
      .write('path/to/resized_image.jpg'); // save
  })
  .catch(err => {
    console.error(err);
  });

Scale image proportionally

This feature allows you to scale an image proportionally. In this example, the image is scaled to 50% of its original size.

const Jimp = require('jimp');

Jimp.read('path/to/image.jpg')
  .then(image => {
    return image.scale(0.5) // scale image to 50%
      .write('path/to/scaled_image.jpg'); // save
  })
  .catch(err => {
    console.error(err);
  });

Contain image within specific dimensions

This feature allows you to resize an image to fit within specific dimensions while maintaining the aspect ratio. In this example, the image is resized to fit within a 300x300 pixel box.

const Jimp = require('jimp');

Jimp.read('path/to/image.jpg')
  .then(image => {
    return image.contain(300, 300) // contain within 300x300
      .write('path/to/contained_image.jpg'); // save
  })
  .catch(err => {
    console.error(err);
  });

Other packages similar to @jimp/plugin-resize

FAQs

Package last updated on 05 Jun 2020

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