views:

60

answers:

3

I develop small application using javascript, using this I can draw on the canvas.I want to know, How get snapshot of my canvas and send it another one,

using javascript or any other server side language. please help me.thanks.

A: 

You can use Canvas2Image to save an HTML 5 canvas to file for download purposes.

Justin Ethier
+2  A: 

You can get a PNG image of the canvas as a data URL via the toDataURL method:

canvas.toDataURL(); // => data:...
J-P
A: 

I use the following:

window.location.href = canvas.toDataURL("image/png").replace("image/png", "image/octet-stream");

This causes the browser's location to change to a data-url containing a PNG of the canvas contents that the browser will then prompt to save (changing the mime-type forces that, otherwise the browser will just display the PNG.)

Tom