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

resize-img

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resize-img

Resize images in memory

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

resize-img Build Status

Resize images in memory

Install

$ npm install resize-img

Usage

const fs = require('fs');
const resizeImg = require('resize-img');

(async () => {
	const image = await resizeImg(fs.readFileSync('unicorn.png'), {
		width: 128,
		height: 128
	});

	fs.writeFileSync('unicorn-128x128.png', image);
})();

API

resizeImg(buffer, options)

Returns a Promise<Buffer> with the resized image.

buffer

Type: Buffer

An image buffer. Supported formats are bmp, jpg and png.

options

Type: Object

width

Type: number

Desired width of the target image.

height

Type: number

Desired height of the target image.

format

Type: string

The output file format for the target image. Supported formats are bmp, jpg and png.

  • resize-img-cli - CLI for this module.

Keywords

FAQs

Package last updated on 19 Sep 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