p5.Image save() Method
The save() method of p5.Image in p5.js is used to save the image to a file by forcing the browser to download it. The file can be saved in two formats, ‘png’ and ‘jpg’. It can also be saved with a ‘gif’ extension if an animated GIF is used with the p5.Image.
Note: It is not recommended calling this function inside the draw() loop, as it will prompt a new save dialog every draw call.
save( filename, extension )
Parameters: This function accepts two parameters as mentioned above and described below.
- filename: It is a String that specifies the filename of the saved file.
- extension: It is a String that specifies the extension of the saved file. It can be either of the value ‘png’ or ‘jpg’.
The examples below illustrate the save() method in p5.js:
Online editor: https://editor.p5js.org/
Environment Setup: https://www.geeksforgeeks.org/p5-js-soundfile-object-installation-and-methods/
Please Login to comment...