/usr/lib/nodejs/imagemagick/test.js is in node-imagemagick 0.1.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | var fs = require('fs'),
im = require('./imagemagick');
var path = __dirname+'/sample-images/blue-bottle-coffee.jpg';
var imdata = fs.readFileSync(path, 'binary');
im.identify(path, function (err, features){
if (err) return console.error(err.stack || err);
console.log('identify(path) ->', features);
})
im.identify({data:imdata}, function (err, features){
if (err) return console.error(err.stack || err);
console.log('identify({data:imdata}) ->', features);
})
im.readMetadata(path, function (err, metadata){
if (err) return console.error(err.stack || err);
console.log('readMetadata(path) ->', metadata);
})
im.readMetadata({data:imdata}, function (err, metadata){
if (err) return console.error(err.stack || err);
console.log('readMetadata({data:imdata} ->', metadata);
})
var timeStarted = new Date;
im.resize({
srcPath: path,
dstPath: 'test-resized.jpg',
width: 256
}, function (err, stdout, stderr){
if (err) return console.error(err.stack || err);
console.log('resize(...) wrote "test-resized.jpg"');
console.log('real time taken for convert: '+((new Date)-timeStarted)+' ms');
im.identify(['-format', '%b', 'test-resized.jpg'], function (err, r){
if (err) throw err;
console.log("identify(['-format', '%b', 'test-resized.jpg']) ->", r);
})
})
timeStarted = new Date;
im.resize({
srcData: imdata,
width: 256
}, function (err, stdout, stderr){
if (err) return console.error(err.stack || err);
console.log('real time taken for convert (with buffers): '+
((new Date)-timeStarted)+' ms');
fs.writeFileSync('test-resized-io.jpg', stdout, 'binary');
console.log('resize(...) wrote "test-resized.jpg" ('+stdout.length+' Bytes)');
})
|