Socket
Socket
Sign inDemoInstall

resize-img

Package Overview
Dependencies
85
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    resize-img

Resize images in memory


Version published
Weekly downloads
49K
increased by5.53%
Maintainers
1
Install size
15.2 MB
Created
Weekly downloads
 

Readme

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

Last updated on 19 Sep 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc