Saving Images
To save an image, simply call save_image()
:
Save the content of the window
ctx.save_image("my_path/my_image.png");
Save the content of any Canvas you created
p6::save_image(my_custom_canvas, "my_path/my_image.png");
Check out a full example here.
We can save either as .png or .jpeg.
tip
If the path already exists, a number will be appended to the name and the previous file won't be overwritten.
If the path is relative, it will be relative to the directory containing your executable.
If some directories in the path don't exist yet, they will be created automatically.