imagemagick with nodejs not working

喜夏-厌秋 提交于 2019-11-26 21:39:12

问题


I am trying to resize an image with node-imagemagick library, but it is not working.

the code i am using to resize is

im.resize({
      srcPath: __dirname+'originalimage.jpg',
      dstPath: __dirname+'resized.jpg',
      width: 50
    }, function(err, stdout, stderr){
      if (err) throw err;

    });

It throws the error

Error: Command failed: Invalid Parameter - -set

    at ChildProcess.<anonymous> (E:\NodeJsDevelopment\node_modules\imagemagick\imagemagick.js:64:15)
    at ChildProcess.EventEmitter.emit (events.js:91:17)
    at Process._handle.onexit (child_process.js:674:10)

回答1:


On windows you also need to install the imagemagick exe. The nodejs imagemagick library is just a wrapper for imagemagick exe. So it will not work untill the imagemagick exe is intalled and convert and identify executable are in path.




回答2:


It is just that you haven't installed ImageMagick in your system. If you are using a Linux distribution you can do:

sudo apt-get install imagemagick


来源:https://stackoverflow.com/questions/11703973/imagemagick-with-nodejs-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!