Source: apc-static/lib/image/resize_image.js

/**
 * Resize a image
 * @function lib.image.resizeImage
 * @param {string} src - Source image file path.
 * @param {object} size - Resize image size.
 * @param {number} size.width - Resize image width.
 * @param {number} size.height - Resize image height.
 * @param {string} dest - Destination image file path.
 * @param {function} callback - Callback when done.
 * @author Taka Okunishi
 *
 */
module.exports = function (src, size, dest, callback) {
    var imagemagick = require('imagemagick');
    if (typeof(size) == 'number') {
        size = {
            width: size,
            height: size
        }
    }
    imagemagick.resize({
        srcPath: src,
        dstPath: dest,
        width: size.width,
        heigth: size.height
    }, function (err) {
        callback(err);
    });
};