今天想试一下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报错啊,帮我看看是什么原因
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
> [email protected] install D:\node\test\20121215\imageprocessing\node_module
s\graphicsmagick
> node-waf clean ; node-waf configure build
'node-waf' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
npm ERR! [email protected] 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 [email protected] 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