diff --git a/lib/args.js b/lib/args.js index ea0ca83..4090b94 100644 --- a/lib/args.js +++ b/lib/args.js @@ -57,7 +57,7 @@ module.exports = function (proto) { * img.append(img).append(true) gm convert src img +append * img.append(img).append(true) gm convert src img +append * img.append(img).background('#222) gm convert src img -background #222 +append - * img.append([img1,img2...],true) + * img.append([img1,img2...],true) * @param {String} or {Array} [img] * @param {Boolean} [ltr] @@ -710,7 +710,7 @@ module.exports = function (proto) { var geometry, wIsValid = Boolean(w || w === 0), hIsValid = Boolean(h || h === 0); - + if (wIsValid && hIsValid) { geometry = w + "x" + h + options } else if (wIsValid) { @@ -726,6 +726,11 @@ module.exports = function (proto) { return this.out("-resize", geometry); } + proto.resizeExact = function resize (w, h) { + var options = "!"; + return proto.resize.apply(this, [w, h, options]); + } + // http://www.graphicsmagick.org/GraphicsMagick.html#details-scale proto.scale = function scale (w, h, options) { options = options || ""; diff --git a/test/resizeWrong.js b/test/resizeWrong.js index 1ef3a68..e3341f9 100644 --- a/test/resizeWrong.js +++ b/test/resizeWrong.js @@ -24,7 +24,21 @@ module.exports = function (_, dir, finish, gm) { gm(name) .size(function (err, size) { if (err) return finish(err); - if (size.width !== width) return finish("Wrong resizing on requested:" + width + ", resized:" + size.width); + if (size.width !== width) { + gm(original) + .resizeExact(width) + .write(name, function (err) { + if (err) return finish(err); + + gm(name) + .size(function (err, size) { + if (err) return finish(err); + if (size.width !== width) { + return finish("Wrong resizing on requested:" + width + ", resized:" + size.width); + } + }); + }); + } if (cb) return cb(); resize(widths[index], index);