Resizes an image using the options provided, and returns a Promise of the transformed Image.

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

  • desiredWidth - The new width in pixels
  • desiredHeight - The new height in pixels
  • mode - The resizing mode, which can be:
    • ImageTools.IGNORE_ASPECT - The image is resized exactly to the desired width and height. This is the default.
    • ImageTools.KEEP_ASPECT- The image is resized to within the closest size possible to the desired size while still maintaining the original aspect ratio.
    • ImageTools.SCALE_AND_CROP - The image is first scaled and centered while maintaining aspect to the closest edge of the desired bounds, then cropped according to the Crop rule. This allows you to make an aspect correct square portrait out of a landscape shot, for instance.
  • performInPlace - Boolean value determining whether the existing image will replaced


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

var options = {
    mode: ImageTools.IGNORE_ASPECT,
    desiredWidth: 320, //The desired width in pixels
    desiredHeight: 240 //The desired height in pixels

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


Fuse.ImageTools 1.11.2



a Promise of an Image