How to use the smartcrop.ImgData function in smartcrop

To help you get started, we’ve selected a few smartcrop examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jwagner / smartcrop-sharp / index.js View on Github external
.then(function(data) {
        if (data.length === image.width * image.height * 3) {
          data = rgb2rgba(data);
        }
        if (data.length !== image.width * image.height * 4) {
          throw new Error('unexpected data length ' + data.length);
        }
        return new smartcrop.ImgData(image.width, image.height, data);
      });
  }
github jwagner / smartcrop-gm / index.js View on Github external
.toBuffer('RGBA', function(err, buffer) {
          if (err) return reject(err);
          resolve(new smartcrop.ImgData(image.width, image.height, buffer));
        });
    });

smartcrop

Content aware image cropping.

MIT
Latest version published 3 years ago

Package Health Score

61 / 100
Full package analysis

Popular smartcrop functions

Similar packages