get() captures a rectangular section of the canvas and returns it as an image. On Safari, if that rectangular section is within the canvas, the image is returned properly, but if that section extends beyond the canvas border, the returned image is entirely blank. On other browsers, the returned image not entirely blank, which is what my program needs. Below is a demo of the issue. If you use other browsers then you see the partially captured yellow in the result. If you use Safari then you will not see any yellow because capturedImage is entirely blank. (Setting “offset” to 0 will capture everything within the canvas, only this way you can see yellow on Safari)
function setup() {
createCanvas(300, 300);
background(250, 250, 0); // yellow canvas
let offset = 50;
// capturedImage has the same size as the canvas
let capturedImage = get(0 + offset, 0, width, height);
background(0); // black canvas
image(capturedImage, 0, 0, width, height);
}
Is there any way to make get() on Safari to behave properly like on other browsers? Thanks.