Thanks, but I still can't figure it out. I added some logging, and it all seems to work, except for drawImage which doesn't draw anything. The image is 16x16 and data:image/png,base64,... displays the correct image when I paste it into the address bar.
<html> <head><script> function draw() { var canvas = document.getElementById('canvas'); var ctx = canvas.getContext('2d'); var img = new Image(); img.src = "data:image/png;base64,..."; console.log(ctx); // CanvasRenderingContext2D object console.log(img); // <img src="data:image/png;base64,..."> ctx.save(); ctx.clearRect(0,0,canvas.width,canvas.height); ctx.drawImage(img,0,0); ctx.restore(); console.log(ctx.getImageData(0,0,canvas.width,canvas.height)); // ImageData object with 19x19 CanvasPixelArray // all 19*19*4 values are 0 return ctx.getImageData(0,0,canvas.width,canvas.height); } function init() { chrome.browserAction.setIcon({imageData:draw()}); } </script></head> <body onload="init()"> <canvas id="canvas" width="19" height="19"></canvas> </body> </html> -- You received this message because you are subscribed to the Google Groups "Chromium-extensions" group. To post to this group, send email to chromium-extensi...@googlegroups.com. To unsubscribe from this group, send email to chromium-extensions+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/chromium-extensions?hl=.