Node JSjs图形魔术不起作用(无效参数 - -调整大小)



我正在尝试使用图形魔术来调整图像大小。我已经安装了最新的GrapchicsMagick和ImageMagick版本。我已经安装了

 npm install gm
 npm install im

太。我的节点.js代码是:

  var gm = require('gm').subClass({imageMagick: true});
  var srcPath = __dirname + '\' + userId + '.jpg';
  var dstPath = __dirname + '\' + userId + '-thumbnail.jpg';
  gm(srcPath)
  .resize(100, 100)
  .noProfile()
  .write(dstPath, function (err) {
    if (!err) console.log('Image resized');
    else console.log(err);
  });

我收到此错误:

 Error: Command failed: Invalid Parameter - -resize

我使用的是Windows 10,我也安装了.exe和npm。

我的问题解决了。我不得不将标识.exe复制到我的应用程序文件夹。

最新更新