I am attempting to upload an image and then display it on a canvas, but at the moment I can only get half of the image to render:
let picture = new Image();
picture.crossOrigin = 'Anonymous';
picture.onload = function() {
let canvas = document.createElement('canvas'),
ctx = canvas.getContext('2d');
ctx.drawImage(picture, 0, 0);
canvas.style.position = 'absolute';
canvas.style.top = 0;
canvas.style.left = 0;
document.body.appendChild(canvas);
}
picture.src = 'https://s3.amazonaws.com/duhaime/blog/visualizations/word-to-viz/heightmap.jpg';
Can anyone identify what might be causing the issue in the code above? Your suggestions would be greatly appreciated!