Return Canvas Data as Image using Canvas.toDataURL() Method

Press first button to draw rectangle in HTML5 canvas element.
Then using the second button, you can save canvas data as image element source.



HTML5 Canvas element:

Image element: