Search within TutorialsPark

HTML5 Canvas URL

Use Canvas Method to Export the contents of Image to URL

Base 64 Encoding:toDataURL()

1.To export the contents of an image to an URL form, use method toDataURL(type, parameter).

2.This method exports the image data to an 64 bit encoded string, which can be used with <img> element or send across the network.

3.The argument type : Denotes the MIME type of Image, default value is "image/png"

4.parameter : If Image type is not PNG then this parameter provides additional encoding detail, it denotes image quality and its value is between 0 and 1.

Example: Canvas Base 64 Encoding, toDataURL().

Give it a TRY! » Note-The output is a string in a PNG format representation of the Canvas bitmap, encoded in a Base64 form data:URL.

Related Examples

Related Tags