resize-png-buffer

1.0.1 • Public • Published

resize-png-buffer

Resize a PNG buffer into square images of different sizes.

Usage

var resizePngBuffer = require('resize-png-buffer')
var fs = require('fs')
 
var resize = resizePngBuffer(fs.readFileSync('image.png'))
 
resize([96, 96], function (err, buffer) {
  if (err) return next(err)
  fs.writeFile('image-96x96.png', buffer, next)
})

resize = resizePngBuffer(buffer)

Returns a resize function, where buffer is the contents of a PNG file as a Node.js Buffer.

resize(shape, done(err, buffer))

Resizes the image using shape, an array with [width, height] for the output image. Calls done(err, buffer) when complete, where buffer is the contents of the output PNG file as a Node.js Buffer.

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.1
    7
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.1
    7
  • 1.0.0
    0

Package Sidebar

Install

npm i resize-png-buffer

Weekly Downloads

7

Version

1.0.1

License

MIT

Last publish

Collaborators

  • yoshuawuyts