7

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)
S. A. Malik
  • 3,465
  • 6
  • 37
  • 56
  • 1
    do you have installed "imagemagick"? not the npm package? ```sudo apt-get install imagemagick``` – jwchang Jul 28 '12 at 20:05

2 Answers2

16

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.

S. A. Malik
  • 3,465
  • 6
  • 37
  • 56
  • 2
    You will need to install imagemagick (the application) on almost all platforms. For example, on the Mac, I installed it using Brew - `brew install imagemagick` – k00k Aug 27 '12 at 14:34
  • 6
    For anyone coming here because you are getting the aforementioned error under windows... put your identify.exe and convert.exe into the same directory as you server.js (or app.js). Simply registering imagemagick globally didn't work for me. – enko Jul 15 '13 at 06:27
  • 3
    Restarting Windows instead of copying those `exe` files worked for me – mcont Mar 31 '15 at 20:06
1

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
Mani K
  • 183
  • 2
  • 10