Sparks
Sparks

Reputation: 25

resize picture with nodeJs imageMagick

I would like to resize some picture before send to user in nodeJs with express

im = require("imagemagick")
app.get('/image/:dossier/:id/:taille', function (req, res) {

    var image = __dirname + '/public/img/bibliotheque/'+req.params.dossier+'/'+req.params.id+'.jpg';
    im.resize({
        srcPath : image,
        width : req.params.taille
    },
    function(err, stdout, stderr) {
        if (err){
            log.error(err);
        } else {
            res.contentType("image/jpeg");
            res.end(stdout);
        }
    });
});

but it's return :

events.js:72
    throw er; // Unhandled 'error' event
          ^
Error: spawn ENOENT
at errnoException (child_process.js:980:11)
at Process.ChildProcess._handle.onexit (child_process.js:771:34)

I try to launch my app with and without sudo but no change
I'm on OSX

Please, help me

Upvotes: 1

Views: 2122

Answers (1)

Kenan
Kenan

Reputation: 3620

You need to install the application in addition to the npm module.

brew install imagemagick

Upvotes: 2

Related Questions