Resets the given canvas to the image size and fills the canvas with the image. This does not create a new canvas so any canvas implementation can be used and existing canvas objects can be re-used.
In a browser you do this:
const canvas = image.toCanvas(document.createElement("canvas"))`;
In Node.js (with node-canvas) you do this:
import { createCanvas} from "canvas";
const canvas = image.toCanvas(createCanvas());
The canvas to reset and fill.
The passed canvas for method chaining.
Interface for classes which provide a
toCanvasmethod to convert an image into a canvas.