Crops the supplied image, and returns a Promise of the transformed Image.

The options parameter must be an object with one or more of the following properties defined:

  • x - X offset for cropped image, from left
  • y - Y offset for cropped image, from top
  • width - Width of cropped image
  • height - Height of cropped image
  • performInPlace - Boolean value determining whether the existing image will replaced

Example

// Here we assume that we have an existing image variable `originalImage`
var ImageTools = require("FuseJS/ImageTools");

var options = {
    width: 10, // Width of cropped image
    height: 10 // Height of cropped image
};

ImageTools.crop(originalImage, options)
    .then(function(newImage) { console.log("Path of cropped image is " + newImage.path); });

Location

Namespace
Fuse.ImageTools
Package
Fuse.ImageTools 2.7.0

Returns

Promise

a Promise of an Image