Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Node.js GraphicsMagick不工作(无效参数--调整大小)_Javascript_Node.js_Imagemagick_Imagemagick Convert_Graphicsmagick - Fatal编程技术网

Javascript Node.js GraphicsMagick不工作(无效参数--调整大小)

Javascript Node.js GraphicsMagick不工作(无效参数--调整大小),javascript,node.js,imagemagick,imagemagick-convert,graphicsmagick,Javascript,Node.js,Imagemagick,Imagemagick Convert,Graphicsmagick,我正在尝试使用来调整图像的大小。我已经安装了最新和最新版本。我已经安装了 npm install gm npm install im 也是My node.js代码是: var gm = require('gm').subClass({imageMagick: true}); var srcPath = __dirname + '\\' + userId + '.jpg'; var dstPath = __dirname + '\\' + userId + '-thumbnai

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

 npm install gm
 npm install im
也是My node.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
我收到此错误:

  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。

我的问题解决了。我必须将identify.exe复制到我的应用程序文件夹中。

您使用的是哪个操作系统?我认为您应该从网站而不是npm安装im。我使用的是Windows 10尝试从此网站安装: