Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does node-imagemagick compare to node-gm?

I want to resize photos, crop photos, etc. That's all.

But I need to be able to deal with PNG's and transparent png's.

Which one should I use?

like image 764
user847495 Avatar asked Dec 16 '11 10:12

user847495


2 Answers

Well they both need some other software installed on your OS (be it GraphicsMagick or ImageMagick), but node-gm has a nicer api, for example:

// crazytown
gm('/path/to/my/img.jpg')
.flip()
.magnify()
.rotate('green', 45)
.blur(7, 3)
.crop(300, 300, 150, 130)
.edge(3)
.write('/path/to/crazy.jpg', function (err) {
  if (!err) console.log('crazytown has arrived');
})

The other module, node-imagemagick, has 4-5 functions, and for the rest you can pass in options.

In terms of performance you should compare ImageMagick with GraphicsMagick, some useful links here:

http://www.graphicsmagick.org/benchmarks.html
http://www.admon.org/graphicsmagick-vs-imagemagick/
http://news.ycombinator.com/item?id=886010

Also you should know that GraphicsMagick is derived from ImageMagick.

like image 90
alessioalex Avatar answered Nov 18 '22 07:11

alessioalex


If you prefer speed, there's a faster (native addon) alternative.

https://npmjs.org/package/imagemagick-native

like image 2
mash Avatar answered Nov 18 '22 07:11

mash