I\'m trying to use drawImage to draw a semi-transparent PNG on a canvas element. However, it draws the image as completely opaque. When I look at the resource that\'s being
NB, if you was to use canvas.toDataURL
and you set the mimetype to anything other than say gif
or png
, the transparent parts of the image will be completely black.
drawing = new Image();
drawing.onload = function () {
context.drawImage(drawing,0,0);
var base64 = canvas.toDataURL('image/png', 1);
};
drawing.src = "draw.png";