Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
74
rated 0 times [  76] [ 2]  / answers: 1 / hits: 68682  / 12 Years ago, mon, may 21, 2012, 12:00:00

I found a quite large list of available libraries on Node.JS wiki but I'm not sure which of those are more mature and provide better performance. Basically I want to do the following:




  1. load some images to a server from external sources

  2. put them onto one big canvas

  3. crop and mask them a bit

  4. apply a filter or two

  5. Resize the final image and give a link to it



Big plus if the node package works on both Linux and Windows.


More From » image

 Answers
11

Answering my own question



I spent two days digging through Node.js graphics libraries.



node-canvas




  • I tried it first since I'm quite familiar with <canvas> API. It's a huge plus for a library.

  • it requires Cairo which doesn't have an easy Windows download. I found it in GTK+ distribution though.

  • moreover it needs native library binding code to be compiled on module installation. It uses Node-Waf which hasn't being ported to Windows yet.



gm




  • mature

  • runs on Windows smoothly

  • docs are ok but not thorough: I had to look up into source code to figure out what API is available

  • unfortunately there's no easy way to combine images with gm. Maybe there's some way to achieve that but I haven't found one after two hours spent with it.



node-imagemagick




  • The official repo has very few basic ImageMagick commands covered but I used this fork (good thing that NPM can pull libraries directly from git repositories). It has bindings for montage which does exactly what I need.

  • ImageMagick is quite slow, though it works on Windows.



Node-Vips




  • Huge plus: it uses an incredible VIPS library which I'm familiar with. VIPS is very fast and optimized for large images. It's very smart about utilizing hardware resources: if your machine has a lot of RAM it'll do all processing in memory but will switch to hard-drive caches if memory is scarce or required for other applications.

  • same as node-canvas it requires Node-Waf so it's not available for Windows yet.



I also looked at other libraries from the list but most of them are either very immature or do not suit my use case. I would really like to try migrating to either Node-Canvas or Node-Vips when Node-Waf gets ported to Windows but until then I'll stick to node-imagemagick.


[#85440] Sunday, May 20, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mickaylag

Total Points: 333
Total Questions: 108
Total Answers: 93

Location: Solomon Islands
Member since Fri, Oct 8, 2021
3 Years ago
;