title: Not able to resize image using ImageMagick Node.js
body: <p>I am trying to resize an image using <a href="https://github.com/rsms/node-imagemagick" rel="nofollow">ImageMagick</a> and I've referred <a href="http://code4node.com/snippet/resize-an-image-using-imagemagick" rel="nofollow">this example</a></p>
  
  <p>and I am getting this error:</p>
  
  <pre><code>{ [Error: Command failed: Invalid Parameter - -set
  ] timedOut: false, killed: false, code: 4, signal: null }
  </code></pre>
  
  <p>Below is my Code:</p>
  
  <pre><code>exports.generateThumbnail=function(imageURL,savePath,filename,callback){
      console.log(imageURL);
      console.log(savePath);
      console.log(filename);
  
      var options = {
         width: 80,
         height: 80,
         srcPath: imageURL,
         dstPath: savePath+"\\thumb_"+filename
      };
  
      im.resize(options, function(err) {
        if(err) { console.log( err); }
        console.log("Image resize complete");
      });
  
  }
  </code></pre>
  
  <p>This is everything I am getting in my console:</p>
  
  <pre><code>fieldNameHere
  { _readableState:
     { highWaterMark: 16384,
       buffer: [],
       length: 0,
       pipes: null,
       pipesCount: 0,
       flowing: false,
       ended: false,
       endEmitted: false,
       reading: false,
       calledRead: false,
       sync: true,
       needReadable: false,
       emittedReadable: false,
       readableListening: false,
       objectMode: false,
       defaultEncoding: 'utf8',
       ranOut: false,
       awaitDrain: 0,
       readingMore: false,
       decoder: null,
       encoding: null },
    readable: true,
    domain: null,
    _events: { end: [Function] },
    _maxListeners: 10,
    truncated: false,
    _read: [Function] }
  look.png
  7bit
  image/png
  .\Images\bhuwan\media\look.pnglook.png
  .\Images\bhuwan\media
  look.png
  { [Error: Command failed: Invalid Parameter - -set
  ] timedOut: false, killed: false, code: 4, signal: null }
  </code></pre>
  
  <p>Also, I've tried every possible library on npmjs.org including the most poppular ones like easyimage and node-thumbnail. None of them are working on windows and have issues listed on github.</p>
  
  <p>What am i doing wrong in this.? Please help.!</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Just in case you need the code in which I am calling the above method:</p>
  
  <pre><code>app.post('/uploadImage',function(req,res){
      console.log('Starting to read params');
      var alias=req.query.alias;
      var imagetype=req.query.imagetype;  //can be media/profile
      console.log(alias);
      console.log(imagetype);
      var busboy = new Busboy({ headers: req.headers });
      busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
          saveTo = ".\\Images\\"+alias+"\\"+imagetype+"\\"+filename;
          saveDirectory= ".\\Images\\"+alias+"\\"+imagetype;
          console.log(fieldname);
          console.log(file);
          console.log(filename); //this is the one
          ImageName=filename;
          console.log(encoding);
          console.log(mimetype);
          imagePathFull=saveTo+filename;
          if (fs.existsSync(saveTo)) {
              file.pipe(fs.createWriteStream(saveTo));
          }
          else{
              mkdirp(".\\Images\\"+alias+"\\"+imagetype,function(err){
                   file.pipe(fs.createWriteStream(saveTo));
              });
          }   
      });
      busboy.on('finish', function() {
          imageHandle.generateThumbnail(imagePathFull,saveDirectory,ImageName,function(err){
              if(!err){
                  res.writeHead(200, { 'Connection': 'close' });
                  res.status(200).end();
              }
              else{
                  res.writeHead(500, { 'Connection': 'close' });
                  res.status(500).end();
              }
          });
  
      });
      return req.pipe(busboy);
  });
  </code></pre>