forked from rsms/node-imagemagick
-
Notifications
You must be signed in to change notification settings - Fork 1
/
test-crop.js
35 lines (32 loc) · 911 Bytes
/
test-crop.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
var fs = require('fs'),
im = require('./imagemagick');
var path = __dirname+'/sample-images/blue-bottle-coffee.jpg';
(function () {
var opt, timeStarted = new Date;
im.crop(opt = {
srcPath: path,
dstPath: 'cropped.jpg',
width: 200,
height: 90,
quality: 1
}, function (err, stdout, stderr){
if (err) return console.error(err.stack || err);
console.log('crop(',opt,') ->', stdout);
console.log('Real time spent: '+(new Date() - timeStarted) + ' ms');
});
})();
(function () {
var opt, timeStarted = new Date;
im.crop(opt = {
srcPath: path,
dstPath: 'cropped2.jpg',
width: 200,
height: 90,
gravity: "North",
quality: 1
}, function (err, stdout, stderr){
if (err) return console.error(err.stack || err);
console.log('crop(',opt,') ->', stdout);
console.log('Real time spent: '+(new Date() - timeStarted) + ' ms');
});
})();