save()
Saves a png image from the display window. save() can optionally take one argument with the filename to save under. If the filename does not end with a .png extension then it will be automatically appended to the filename. Images are saved to the project folder.
Note that it is not recommended to call this function within draw as it will save repeatedly on every render.
Examples
save example 1
function setup()
fill(0)
ellipse(random(width),random(height),random(100),random(100))
-- Saves the canvas as an image to a specified filename
save('mySketch.png')
describe('An example for saving a sketch window as an image.')
end
save example 2
function setup()
fill(0)
ellipse(random(width),random(height),random(100),random(100))
-- Saves the canvas as an image to a randomly generated filename
save()
describe('An example for saving a canvas as an image.')
end
Syntax
save(filename)
save()
Parameters
| Parameter | |
|---|---|
| filename | String: any sequence of letters and numbers, optionally with '.png' extension |