Skip to content

Commit

Permalink
use size instead of resize
Browse files Browse the repository at this point in the history
  • Loading branch information
sdepold authored and Rasmus Andersson committed Oct 7, 2010
1 parent 9b5a721 commit 58c4b6f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions imagemagick.js
Expand Up @@ -223,14 +223,16 @@ exports.crop = function(options, callback) {

t.args.forEach(function(arg) {
// ignoreArg is set when resize flag was found
if(!ignoreArg) args.push(arg)
if(!ignoreArg && (arg != '-resize')) args.push(arg)

// found resize flag! ignore the next argument
if(arg == '-resize') ignoreArg = true

// found the argument after the resize flag; ignore it and set crop options
if((arg != "-resize") && ignoreArg) {
ignoreArg = false

args.push("-size")
args.push(resizeArg)
args.push('-gravity')
args.push('center')
Expand All @@ -240,7 +242,6 @@ exports.crop = function(options, callback) {
}
})
t.args = args

resizeCall(t, callback)
})
}
Expand Down
6 changes: 3 additions & 3 deletions test-crop.js
Expand Up @@ -2,14 +2,14 @@ var sys = require('sys'),
fs = require('fs'),
im = require('./imagemagick');

var path = 'an_image.png';
var path = 'an_image.jpg';
var timeStarted = new Date;

im.crop({
srcPath: path,
dstPath: path + '.cropped.jpg',
width: 800,
height: 600,
width: 700,
height: 400,
quality: 1
}, function(err, stdout, stderr){
if (err) return sys.error(err.stack || err);
Expand Down

0 comments on commit 58c4b6f

Please sign in to comment.