用过easyimage的大师过来瞧瞧了
发布于 11 年前 作者 iln168 6637 次浏览 最后一次编辑是 8 年前

今天想试一下easyimage来处理上传的图片,按教程: (1 安装easyimage)$ npm install easyimage (2)代码

var easyimg = require('easyimage');
easyimg.convert({src:'beach.jpg', dst:'beach.png', quality:10}, function(err, stdout, stderr) {
if (err) throw err;
console.log('Converted JPG to PNG, quality set at 10/100');
});

beach.jpg为直接目录下的图片文件报错如下 :

Error: Command failed: 锟斤拷效锟斤拷锟斤拷 - "beach.png"

at ChildProcess.exithandler (child_process.js:540:15)
at ChildProcess.EventEmitter.emit (events.js:96:17)
at maybeClose (child_process.js:638:16)
at Process._handle.onexit (child_process.js:680:5)

不知道什么原因

或是帮我推介一个图片处理的方法。

5 回复

我用 ImageMagick 比较多,都是在命令行里面调用的。

安装ImageMagick报错啊,帮我看看是什么原因

  D:\node\test\20121215\imageprocessing>npm install graphicsmagick
npm http GET https://registry.npmjs.org/graphicsmagick
npm http 200 https://registry.npmjs.org/graphicsmagick
npm http GET https://registry.npmjs.org/graphicsmagick/-/graphicsmagick-0.0.1.tg
z
npm http 200 https://registry.npmjs.org/graphicsmagick/-/graphicsmagick-0.0.1.tg
z

> graphicsmagick@0.0.1 install D:\node\test\20121215\imageprocessing\node_module
s\graphicsmagick
> node-waf clean ; node-waf configure build

'node-waf' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
npm ERR! graphicsmagick@0.0.1 install: `node-waf clean ; node-waf configure buil
d`
npm ERR! `cmd "/c" "node-waf clean ; node-waf configure build"` failed with 1
npm ERR!
npm ERR! Failed at the graphicsmagick@0.0.1 install script.
npm ERR! This is most likely a problem with the graphicsmagick package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-waf clean ; node-waf configure build
npm ERR! You can get their info via:
npm ERR!     npm owner ls graphicsmagick
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 5.1.2600
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "graphicsmagick"
npm ERR! cwd D:\node\test\20121215\imageprocessing
npm ERR! node -v v0.8.12
npm ERR! npm -v 1.1.63
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     D:\node\test\20121215\imageprocessing\npm-debug.log
npm ERR! not ok code 0

@iln168 你本地安装 imagemagick 这个软件了么?

@genedna 这就是安装时报错的

@iln168 这个包安装的时候应该是调本地 imagemagick 的 Lib 进行编译,所以你应该是没有装吧。再说你这个是 Windows,能装上 ImageMagick 么,我不确定。

回到顶部