1.0.0 • Published 8 years ago

smart-crop v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

smart-crop Build Status

Get smart cropping coordinates to an images (based on https://github.com/thumbor/thumbor/wiki/Detection-algorithms)

Installation

Download node at nodejs.org and install it, if you haven't already.

npm install smart-crop --save

Usage

var smartCrop = require("smart-crop");

var foo = [];
var opencv = require('opencv');
var readFileSync = require('fs').readFileSync;

smartCrop({
  image: readFileSync(__dirname + '/test/obama.jpg'),
  width: 200,
  height: 100
}, function(err, results) {
    console.log('obama');
    // results.method === 'faces'
    console.log(
      results.method,
      results.right,
      results.bottom,
      results.left,
      results.top
    );
  });

smartCrop({
  image: readFileSync(__dirname + '/test/moon.jpg'),
  width: 200,
  height: 100
}, function(err, results) {
    console.log('moon');
    // results.method === 'good-features'
    console.log(
      results.method,
      results.right,
      results.bottom,
      results.left,
      results.top
    );
  });

Tests

npm install
npm test

Dependencies

Dev Dependencies

  • tape: tap-producing test harness for node and browsers

License

MIT

Generated by package-json-to-readme