Node.js GraphicsMagick不工作(无效的参数 – – 大小)
我正在尝试使用Graphics Magick来调整图像大小。 我已经安装了最新的GrapchicsMagick和ImageMagick版本。 我已经安装了
npm install gm npm install im
太。 我的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
我使用的是Windows 10,我也安装了.exe和npm。
我的问题解决了。 我不得不将ident.exe复制到我的应用程序文件夹。