Sorry about the red box, but we really need you to update your browser. Read this excellent article if you're wondering why we are no longer supporting this browser version. Go to Browse Happy for browser suggestions and how to update.

API Reference

HTML5 Canvas

The HTML5 canvas element provides a container for JavaScript to draw graphics on a web page. It is a resolution dependent rectangular area with per-pixel control.
The canvas element has several methods for drawing paths, boxes, circles, characters, and adding images.
Any text inside the between <canvas> tags will be displayed in browsers that do not support the canvas element.

Returns an object for contextId.
Returns null if the given context ID is not supported or if the canvas has already been initialised with some other (incompatible)
context type (e.g. trying to get a "2d" context after getting a "experimental-webgl" context).

static
String
canvas.toDataURL
([type : String])

The argument, if provided, controls the type of the image to be returned (e.g. PNG or JPEG).
The default is image/png; that type is also used if the given type isn't supported.

Return:

When called with no arguments, returns a data:URL containing a representation of the image as a PNG file.
If the canvas has no pixels (i.e. either its horizontal dimension or its vertical dimension is zero) then the method must return the string "data:,".
When the method is called with one arguments, it must return a data:URL containing a representation of the image in the format
given by type. The possible values are MIME types with no parameters, for example image/png, image/jpeg,
or even maybe image/svg+xml if the implementation actually keeps enough information to reliably render an SVG image from the canvas.