Freshchris Freshchris - 1 year ago 170
HTML Question

Download Canvas as Image without .toDataUrl()

Is it possible to download the (edited) Image of a Canvas Element in

without using the
function? I tested some frameworks but they still use this function.

Answer Source

In newer browsers, you can get MUCH larger images and faster performance with the async method canvas.toBlob(callback, mimeType, qualityArgument);

see the mdc article for details and compat (basically IE10+)

the blob doesn't have the same size limits that dataURL realistically face in many browsers and devices, so where supported, it leads to a much better user experience.

if you later want to turn the blob into a dataURL, use FileReader.readAsDataURL(blob)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download