Permalink
Browse files

Added custom crop options

  • Loading branch information...
1 parent d855acf commit 455fb1d414b9ce27454755b9dad9d507e2648193 @michalkow committed Sep 25, 2011
Showing with 5 additions and 2 deletions.
  1. +5 −2 imagemagick.js
View
@@ -302,8 +302,8 @@ exports.crop = function (options, callback) {
resizeTo = (dSrc < dDst) ? ''+t.opt.width+'x' : 'x'+t.opt.height;
args = args.concat([
'-resize', resizeTo,
- '-gravity', 'Center',
- '-crop', ''+t.opt.width + 'x' + t.opt.height + '+0+0',
+ '-gravity', t.opt.gravity,
+ '-crop', ''+t.opt.width + 'x' + t.opt.height + '+' + t.opt.top + '+' + t.opt.left,
'+repage'
]);
ignoreArg = false;
@@ -327,6 +327,9 @@ exports.resizeArgs = function(options) {
colorspace: null,
width: 0,
height: 0,
+ gravity: 'NorthWest',
+ top: 0,
+ left: 0,
strip: true,
filter: 'Lagrange',
sharpening: 0.2,

0 comments on commit 455fb1d

Please sign in to comment.