To open your options: Using fabric.js you could serialize your fabric.js canvas to JSON.
Not only does it provide an additional layer of editing capabilities but allows you to do the following (Not to mention being able to edit their images at a later stage) :
var canvas = new fabric.Canvas('c'); canvas.add( new fabric.Rect({ top: 100, left: 100, width: 50, height: 50, fill: '#f55' }), new fabric.Circle({ top: 140, left: 230, radius: 75, fill: 'green' }), new fabric.Triangle({ top: 300, left: 210, width: 100, height: 100, fill: 'blue' }) );
Now when you want to serialize this canvas you simply call the JSON.stringify function on the fabric canvas object;
JSON.stringify(canvas);
Which gives you something like the following for our example above:
{ "objects": [ { "type": "rect", "left": 100, "top": 100, "width": 50, "height": 50, "fill": "#f55", "overlayFill": null, "stroke": null, "strokeWidth": 1, "scaleX": 1, "scaleY": 1, "angle": 0, "flipX": false, "flipY": false, "opacity": 1, "selectable": true }, ... ] }
De serializing the canvas back to its state is reversed by using:
var canvas = new fabric.Canvas('c'); canvas.loadFromJSON(yourJSONString);
Some Additional Resources:
Kitchen Sink Demo - View the capabilities of fabric.js (Including free drawing; modifying the size and position of the free drawing afterwards)
Homepage