# Saving images from drawing

**URL:** <https://discourse.processing.org/t/saving-images-from-drawing/43953>\
**Category:** p5py\
**Created:** [February 20, 2024, 8:56am UTC](https://discourse.processing.org/t/saving-images-from-drawing/43953 "2024-02-20T08:56:28Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kamel0](https://avatars.discourse-cdn.com/v4/letter/k/ebca7d/32.png) [@Kamel0](https://discourse.processing.org/u/Kamel0)\
**Post date:** [February 20, 2024, 8:56am UTC](https://discourse.processing.org/t/saving-images-from-drawing/43953/1 "2024-02-20T08:56:28Z")

</div>

Hello,  
Can you point me to an example of saving image(s)? I want to save an image or sequence of images of what is drawn using p5py.  
I assume this relates to using the offscreen buffer. Please clarify.  
Thanks!

---

<div class="post-metadata">

**Author:** ![cattclawzz](https://avatars.discourse-cdn.com/v4/letter/c/a9adbd/32.png) [@cattclawzz](https://discourse.processing.org/u/cattclawzz)\
**Post date:** [February 20, 2024, 11:53am UTC](https://discourse.processing.org/t/saving-images-from-drawing/43953/2 "2024-02-20T11:53:09Z")

</div>

this what you’re looking for?  
[saveFrame() / Reference / Processing.org](https://processing.org/reference/saveFrame_.html)

---

<div class="post-metadata">

**Author:** ![Kamel0](https://avatars.discourse-cdn.com/v4/letter/k/ebca7d/32.png) [@Kamel0](https://discourse.processing.org/u/Kamel0)\
**Post date:** [February 20, 2024, 3:06pm UTC](https://discourse.processing.org/t/saving-images-from-drawing/43953/3 "2024-02-20T15:06:48Z")

</div>

Yes, that works for me, thanks!

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [February 21, 2024, 3:25am UTC](https://discourse.processing.org/t/saving-images-from-drawing/43953/4 "2024-02-21T03:25:53Z")

</div>

[https://py5Coding.org/reference/sketch\_save\_frame.html](https://py5Coding.org/reference/sketch_save_frame.html)

---

<div class="post-metadata">

**Author:** ![ProcessingOrg](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/processingorg/32/18341_2.png) [@ProcessingOrg](https://discourse.processing.org/u/ProcessingOrg)\
**Post date:** [February 27, 2024, 11:08am UTC](https://discourse.processing.org/t/saving-images-from-drawing/43953/5 "2024-02-27T11:08:04Z")

</div>

Since you are using [p5py](https://p5.readthedocs.io/en/latest/) you can save image sequences with `save_frame()`. From the documentation:

> ### save\_frame()
> 
> `p5.` `save_frame` (_filename=‘screen.png’_ )
> 
> Save a numbered sequence of images whenever the function is run.
> 
> Saves a numbered sequence of images, one image each time the function is run. To save an image that is identical to the display window, run the function at the end of [`p5.draw()`](https://p5.readthedocs.io/en/latest/reference/structure.html#p5.draw) or within mouse and key events such as `p5.mouse_pressed()` and `p5.key_pressed()`.
> 
> If save\_frame() is used without parameters, it will save files as screen-0000.png, screen-0001.png, and so on. Append a file extension, to indicate the file format to be used. Image files are saved to the sketch’s folder. Alternatively, the files can be saved to any location on the computer by using an absolute path (something that starts with / on Unix and Linux, or a drive letter on Windows).
> 
> Parameters: **filename** (_str_) – name (or name with path) of the image file. (defaults to `screen.png`)

Source: [Output — p5 0.8.1 documentation](https://p5.readthedocs.io/en/latest/reference/output.html?highlight=save_frame#p5.save_frame)
