CanvasContext2DDraImage()问题[onload和CORS]
dataURL()
A
"data:image/png;base64,iVBO..some random chars... bQhfoAAAAAAAAAA... a lot of A ...AAAASUVORK5CYII="
)
var img = new Image();img.src = "http://somerandomWebsite/picture.png";var canvas = document.createElement('canvas'); canvas.width = img.width;canvas.height = img.height;var context = canvas.getContext('2d');context.drawImage(img, 0,0); // this doesn't seem to workvar dataURL = canvas.toDataURL(); // this will give me a lot of "A" doSomething(dataURL);
dataURL
相关分类