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