Search code examples
jqueryimagecanvasserver-sideraphael

Saving a rasterisation of a canvas element, server side


I've built a page which uses some jQuery, and Raphael (vectors and images on canvas), to allow a user to customise a picture by choosing a few colors. The whole canvas can be recreated on the client side by being initialized with an array of simple arguments like:

  initCanvas({
    'wall' : 'green',
    'ceiling' : 'black',
    'floor' : 'white'
  })

So anything a user created could be recreated easily.

Is it possible get the server to render and save this canvas as an image?

Any suggestions to point me in the right direction would be great.


Solution

  • It appears as though this would be a good solution to your problem: http://www.benbarnett.net/2010/06/04/export-svg-from-raphael-js-to-create-a-png-bitmap/