When trying to use Jcrop with a transparent background canvas it renders it in black, I've checked online, and the solution given as per the question on jcrop turns transparent image black doesn't work for me, it still produces a black background. Below is my code. Any help towards getting this working would be greatly appreciated!
var maxWidth = 200;
var img = new Image();
img.onload = function() {
var canvas = document.createElement('canvas');
canvas.width = maxWidth;
canvas.height = img.height * (maxWidth / img.width);
var ctx = canvas.getContext('2d');
ctx.drawImage(img, 0, 0, canvas.width, canvas.height);
document.getElementById('image').src = canvas.toDataURL();
$('#image').Jcrop({
bgColor:'',
setSelect: [0, 0, canvas.width, canvas.height]
});
}
img.setAttribute('crossOrigin', 'anonymous');
img.src = 'https://z1.porter21.com/wp-content/uploads/sites/2/2015/02/sprite1.png';
A live sample can be found at https://jsfiddle.net/9Lmapguv/