Reputation: 3140
I am using this code to resize images. The resize works just fine, except the image background changes from transparent to black. I would like to maintain the transparent background but haven't found a resource explaining how to do it.
https://jsfiddle.net/skwny/gh7c2mpa/
see fiddle
Upvotes: 3
Views: 1769
Reputation: 6527
For image transparency, you need a proper image format change image/jpeg
to image/png
var dataUrl = canvas.toDataURL('image/png');
Upvotes: 4