HTMLCanvasElement.ToDataURL

ToDataURL()

returns a data URI containing a representation of the image in the format specified by the type parameter (defaults to PNG). The returned image is in a resolution of 96 dpi.

public String ToDataURL()

Return Value

A DOMString containing the requested data URI.

See Also


ToDataURL(String)

returns a data URI containing a representation of the image in the format specified by the type parameter (defaults to PNG). The returned image is in a resolution of 96 dpi.

public String ToDataURL(String type)
ParameterTypeDescription
typeStringA String indicating the image format. The default format type is image/png.

Return Value

A DOMString containing the requested data URI.

See Also


ToDataURL(String, double)

returns a data URI containing a representation of the image in the format specified by the type parameter (defaults to PNG). The returned image is in a resolution of 96 dpi.

public String ToDataURL(String type, double encoderOptions)
ParameterTypeDescription
typeStringA String indicating the image format. The default format type is image/png.
encoderOptionsDoubleA Number between 0 and 1 indicating image quality if the requested type is image/jpeg or image/webp.

Return Value

A DOMString containing the requested data URI.

See Also