smart-crop

1.0.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i smart-crop

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • kesla