Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Added custom crop options #24

Open
wants to merge 1 commit into
from
Jump to file or symbol
Failed to load files and symbols.
+5 −2
Split
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,