8000 GitHub - fredericgermain/image-resize-stream: A streaming interface for resizing image buffers in node
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

fredericgermain/image-resize-stream

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

image-resize-stream Flattr this!experimental

A streaming interface for resizing image buffers in node.

Internally, this is actually buffering the stream input before creating the resized image using the canvas module and pushing out the new image buffer synchronously. So there's room for improvement - pull requests welcome :)

Usage

image-resize-stream

createStream(width, height[, options])

Creates a transform stream which will take an image buffer as input, streaming out a resized image buffer as output. Both width and height are optional parameters, but you must specify at least one of them. You can omit them by passing in null, e.g. to resize to fit 100 pixels high:

var resize = require('image-resize-stream')
var fs = require('fs')

fs.createReadStream('original.png')
  .pipe(resize(null, 100))
  .pipe(fs.createWriteStream('original-100.png'))

The stream's options are as follows:

  • crop: either true or false, defaulting to false.
  • format: may be either png or jpg.
  • quality: if creating a jpg image, this should be a number between 0 and 100 to determine the quality of the output image.
  • smaller: whether to scale to handle the smallest of width/height or heighest, when both are supplied. Defaults to false.

License

MIT. See LICENSE.md for details.

About

A streaming interface for resizing image buffers in node

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%
0