2013年2月10日 星期日

[Node.js] GraphicsMagick for node.js, install on MacOS

GraphicsMagick for node.js, this is a powerful framework. It's based on many different frameworks, so, that first and hardest one we need to do, is to install it.

1. Download Command tools for MacOS, if you don't have gcc compiler

2. Download libpng-1.4.7.tar.gz. For displaying PNG image, and install it with :
     1. ./configure
     2. make && sudo make install

3. Download libjpeg-6b.tar.bz2. For displaying JPEG image, and install it with :
     1. ./configure
     2. make && sudo make install

4. Visit their home page : http://www.graphicsmagick.org/, download GraphicsMagick-1.3.17.tar.bz2. and Install it with :
     1. ./configure CC=clang
           (*NOTE*, I got Undefined symbols for architecture x86_64 because I didn't add CC=clang, and cause lots of time, if you got the same problem, please remember to add it)
           After run the configure, it'll show the result for it, you'll need these two as yes.
              JPEG v1   --with-jpeg=yes    yes(Need to install jpeg delegate library)
              PNG       --with-png=yes     yes(Need to install png delegate library)

     2. make && sudo make install

5. In node.js, put the following code :
     var gm = require('gm');
     gm('image.jpg').size(function(err, value){
          if(err) return;
          console.log(value);
     }




If you still get any problems or found something wrong in this post, please feel free to tell me. :)


Reference :

https://github.com/rsms/node-imagemagick
http://aheckmann.github.com/gm
http://rritw.com/a/bianchengyuyan/C__/20130201/301529.html
http://qing.weibo.com/1838939461/6d9bfd4533000j33.html

沒有留言:

張貼留言