Skip to content
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
..
Failed to load latest commit information.
lib
markdown
public
routes
views
.gitignore
Readme.md
Readme.zh.md
app.js
package.json

Readme.md

Server Side Functionality

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.

Deploy Instructions:

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:

For Mac Users:

1. Install Canvas Dependency

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/

2. Use npm to install other modules automatically

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.

3. Starting the App.

Run:

    node app.js

After staring the app successfully, visit: http://localhost:7777 in your browser, that's it!

For Ubuntu Users

1. Install Canvas Dependency(Ubuntu 12.04)

  • 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.

2. Use npm to install other modules automatically

Follow the 2nd Step For Mac Users.

3. Starting the App.

Follow the 3rd Step For Mac Users.

For Windows 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.

Something went wrong with that request. Please try again.