I have bene using node-imagemagick for a few days now and have come to realize that it has bugs.
我现在已经使用node-imagemagick好几天了,并且已经意识到它有bug。
There are about 100 forks of it, some of which fix some of the issues i have come across, but it is hard to figure out which fork i should use.
它有大约100个叉子,其中一些解决了我遇到的一些问题,但很难弄清楚我应该使用哪个叉子。
2 个解决方案
#1
16
I chose to use gm node module on one of my project. It works pretty well.
我选择在我的一个项目中使用gm节点模块。它工作得很好。
See : http://aheckmann.github.com/gm/
请参阅:http://aheckmann.github.com/gm/
It's basically a wrapper around imageMagick or graphicsmagick binaries.
它基本上是imageMagick或graphicsmagick二进制文件的包装器。
Here is a simple example :
这是一个简单的例子:
var gm = require('gm');
gm('/path/to/image.jpg')
.resize(353, 257)
.autoOrient()
.write(writeStream, function (err) {
if (!err) console.log(' hooray! ');
});
#2
24
I once was in your position and after getting really frustrated with modules that had bugs or weird APIs I started using imagemagic directly by spawning a child process. Node.js is pretty good at this so it's actually not that hard.
我曾经处于你的位置,在对带有错误或奇怪API的模块感到非常沮丧之后,我开始直接通过生成子进程来使用imagemagic。 Node.js相当不错,所以它实际上并不那么难。
var spawn = require('child_process').spawn;
var args = ['-ping', 'tree.gif' ];
var composite = spawn('identify', args);
It's also great because you can just use the imagemagic documentation.
它也很棒,因为你可以使用imagemagic文档。
#1
16
I chose to use gm node module on one of my project. It works pretty well.
我选择在我的一个项目中使用gm节点模块。它工作得很好。
See : http://aheckmann.github.com/gm/
请参阅:http://aheckmann.github.com/gm/
It's basically a wrapper around imageMagick or graphicsmagick binaries.
它基本上是imageMagick或graphicsmagick二进制文件的包装器。
Here is a simple example :
这是一个简单的例子:
var gm = require('gm');
gm('/path/to/image.jpg')
.resize(353, 257)
.autoOrient()
.write(writeStream, function (err) {
if (!err) console.log(' hooray! ');
});
#2
24
I once was in your position and after getting really frustrated with modules that had bugs or weird APIs I started using imagemagic directly by spawning a child process. Node.js is pretty good at this so it's actually not that hard.
我曾经处于你的位置,在对带有错误或奇怪API的模块感到非常沮丧之后,我开始直接通过生成子进程来使用imagemagic。 Node.js相当不错,所以它实际上并不那么难。
var spawn = require('child_process').spawn;
var args = ['-ping', 'tree.gif' ];
var composite = spawn('identify', args);
It's also great because you can just use the imagemagic documentation.
它也很棒,因为你可以使用imagemagic文档。