0.0.3 • Published 7 years ago

node-pixelate v0.0.3

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

pixelate

Pixelate images

Install

npm install node-pixelate

It's using node-canvas (rather than ImageMagick) and one of the requirements for it is the Cairo canvas implementation, so Cairo needs to be installed. Instructions.

Usage

var fs = require('fs');
var pixelate = require('node-pixelate');

fs.readFile(__dirname + '/images/street.png', function(error, dataBuffer) {
  if (error) throw error;
  pixelate(dataBuffer, {
    // scale down 90 percent (really pixelated). Default: 0.
    scale: 0.9,
    // max width keeping aspect ratio, unless height specified. Default: original width.
    width: 500,
  }, function(error, pixelatedDataBuffer) {
    fs.writeFile(__dirname + '/images/pixelated-street.png', pixelatedDataBuffer, function(error) {
      if (error) throw error;
      console.log('Done.');
    });
  });
});

Requirements

Mac OS X

brew install graphicsmagick

License

MIT

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago