public
Last active

simple comparison of identify command vs binding

  • Download Gist
test.js
JavaScript
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 36 37
var imagick = require('imagick');
var imagemagick = require('imagemagick');
var path = require('path');
var assert = require('assert');
 
args = [
'-format',
'~~~%w~~~%h~~~%x~~~%C',
path.resolve('./logo.png'),
];
console.log('using:', args.join(' '));
 
function test(count, start, lib, args, end) {
if (count <= 0) {
end(start);
return;
}
lib.identify(args, function (error, metadata) {
assert.strictEqual(metadata.trim(), '~~~245~~~66~~~72 Undefined~~~Zip');
test(--count, start, lib, args, end);
});
};
 
var COUNT = 1000;
test(COUNT, Date.now(), imagick, args, function (start) {
console.log('imagick did', COUNT, 'in', (Date.now()-start)/1000, 'seconds');
test(COUNT, Date.now(), imagemagick, args, function (start) {
console.log('imagemagick did', COUNT, 'in', (Date.now()-start)/1000, 'seconds');
});
});
 
/* output
using: -format ~~~%w~~~%h~~~%x~~~%C /home/tjfontaine/development/test/logo.png
imagick did 1000 in 0.323 seconds
imagemagick did 1000 in 5.366 seconds
*/

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.