admin管理员组

文章数量:1429763

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?

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?

Share Improve this question edited Apr 8, 2014 at 8:00 user1180790 asked Apr 8, 2014 at 7:36 user3509834user3509834 312 bronze badges 2
  • 2 ENOENT means Error NO ENTry. The problem occurs when it tries to write, check your permissions – Lorenzo Marcon Commented Apr 8, 2014 at 7:39
  • Or when a certain cache is full. – Robbie Bardijn Commented Apr 8, 2014 at 8:01
Add a ment  | 

2 Answers 2

Reset to default 7

Replace:

var gm = require('gm');

for

var gm = require('gm').subClass({ imageMagick: true });

Recipe for MacPorts users only (based on @RevNoah notice):

sudo port install GraphicsMagick

It will install GraphicsMagick library.

本文标签: javascriptnodejsError spawn ENOENT while adjusting image size using module gmStack Overflow