How to render a blob on a canvas element?
问题 How to render an image blob to a canvas element? So far i have these two (simplified) functions to capture an image, transform it to a blob and eventually render the blob on a canvas in this codepen, it just returns the default black image. var canvas = document.getElementById('canvas'); var input = document.getElementById('input'); var ctx = canvas.getContext('2d'); var photo; function picToBlob() { var file = input.files[0]; canvas.toBlob(function(blob) { var newImg = document.createElement