npm.io
0.1.0 • Published 12 years agoCLI

gm-to-grayscale

Licence
Version
0.1.0
Deps
2
Vulns
0
Weekly
0

gm-to-grayscale

Use gm to read an RGB buffer/image and make it grayscale.

Installation

npm install gm-to-grayscale

Usage

#!/usr/bin/env node
var gmToGrayscale = require('gm-to-grayscale');

gmToGrayscale('my-photo.png'), function (err, result) {
  if (err) {
    throw err;
  }

  console.log('Image size: ' + result.width + 'x' + result.height);

  fs.writeFile('my-photo.gray', result.image, function (err) {
    if (err) {
      throw err;
    }
  });
});

Keywords