The node server side of PSD2HTML is used to process the *.txt(which contains the position infomation of image slices or text, along with other font-style details in json format) and *.png(which is a snapshot of the psd file being processed) outputs generated by PSD2HTML.jsx to provide a general html preview or even more, generate the html file and image slices required, pack all the resources up, and provide a download link.
We suppose that you have already installed nodeJS, V0.6.17 or higher is preferred.
All node modules required: express/jade/jsdom/canvas.
Theoretically, it will work after you have ran npm install -d command successfully in server directory. However, things may not be that easy, as node-canvas module depends on cairo library, we must install cairo and some other image processing libraries first.
Generally speaking, following these 3 steps will work:
As cairo, pnglib and jpglib have already been installed in Mac OS and that giflib is not a must, you can skip this step.
BTW: if you want to use node-canvas to process gif images, you should install gif lib by running:
brew install giflib
For more infomation about brew, visit: http://mxcl.github.com/homebrew/
Update git repository, change to server dir and run:
npm install -d
After executing this command successfully, all the required modules will be installed to server/node_modules directory. It may cost a long time the first time.
Run:
node app.js
After staring the app successfully, visit: http://localhost:7777 in your browser, that's it!
-
Install cairo
Run:sudo apt-get install libcairo2-dev
-
Install png、jpg、gif Libraries
sudo apt-get install libpng12-dev
sudo apt-get install libjpeg-dev
sudo apt-get install libgif-dev
NOTICE: Although node-canvas can be installed if you skip the 2nd step, you will get a error when calling canvas.createJPEGStream method. This case, you should following the 2nd step and reinstall node-canvas to get certain image type been supported.
Follow the 2nd Step For Mac Users.
Follow the 3rd Step For Mac Users.
Unfortunately, the server side doesn't support windows currently. There might be quite a lot of problems when installing node-canvas and jsdom in windows.