Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nodejs - Error: spawn ENOENT while adjusting image size using module gm

I am trying to create a thumbnail with an image that I have already saved. I am using the module gm to adjust the size of the image.

var gm = require ('gm');
var fs = require('fs');
var savedphoto = "./testphoto.jpeg";
var testdir = "./testoutput.jpeg";
gm(savedphoto)
    .resize(100, 100)
    .noProfile()
    .write(testdir, function (err) {
        console.error (err);
    });

When I run this I get the error spawn ENOENT.

code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn. 

How would I fix this problem?

like image 786
user3509834 Avatar asked Aug 23 '26 09:08

user3509834


1 Answers

Replace:

var gm = require('gm');

for

var gm = require('gm').subClass({ imageMagick: true });
like image 84
DadoCe Avatar answered Aug 24 '26 22:08

DadoCe