resize-img
Resize images in memory
Last updated 7 years ago by kevva .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install resize-img 
SYNC missed versions from official npm registry.

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.

Related

Current Tags

  • 2.0.0                                ...           latest (7 years ago)

5 Versions

  • 2.0.0                                ...           7 years ago
  • 1.1.2                                ...           10 years ago
  • 1.1.1                                ...           10 years ago
  • 1.1.0                                ...           11 years ago
  • 1.0.0                                ...           11 years ago
Maintainers (1)
Downloads
Total 17
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 8
Dependencies (2)
Dev Dependencies (3)
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE