pub static saveCanvas: SaveCanvasInternalTypeExpand description
Save the current canvas as an image. The browser will either save the file immediately, or prompt the user with a dialogue window.
Examples
function setup() {
let c = createCanvas(100, 100);
background(255, 0, 0);
saveCanvas(c, 'myCanvas', 'jpg');
} // note that this example has the same result as above
// if no canvas is specified, defaults to main canvas
function setup() {
let c = createCanvas(100, 100);
background(255, 0, 0);
saveCanvas('myCanvas', 'jpg');
// all of the following are valid
saveCanvas(c, 'myCanvas', 'jpg');
saveCanvas(c, 'myCanvas.jpg');
saveCanvas(c, 'myCanvas');
saveCanvas(c);
saveCanvas('myCanvas', 'png');
saveCanvas('myCanvas');
saveCanvas();
}Overloads
selectedCanvas a variable
representing a specific html5 canvas (optional)
filename?
extension? ‘jpg’ or ‘png’
filename?
extension? ‘jpg’ or ‘png’