Reputation: 1251
Is it possible to download the (edited) Image of a Canvas Element in HTML
without using the .toDataUrl()
function? I tested some frameworks but they still use this function.
Upvotes: 4
Views: 589
Reputation: 16726
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)
Upvotes: 4