Skip to content

Instantly share code, notes, and snippets.

@tjfontaine
Last active December 10, 2015 05:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tjfontaine/4391835 to your computer and use it in GitHub Desktop.
Save tjfontaine/4391835 to your computer and use it in GitHub Desktop.
simple comparison of identify command vs binding
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
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment