# Please tell me how to save the Processing file as PNG

**URL:** <https://discourse.processing.org/t/please-tell-me-how-to-save-the-processing-file-as-png/36741>\
**Category:** Beginners\
**Tags:** homework\
**Created:** [May 6, 2022, 4:36am UTC](https://discourse.processing.org/t/please-tell-me-how-to-save-the-processing-file-as-png/36741 "2022-05-06T04:36:43Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![alalal](https://avatars.discourse-cdn.com/v4/letter/a/ce7236/32.png) [@alalal](https://discourse.processing.org/u/alalal)\
**Post date:** [May 6, 2022, 4:36am UTC](https://discourse.processing.org/t/please-tell-me-how-to-save-the-processing-file-as-png/36741/1 "2022-05-06T04:36:43Z")

</div>

> please format code with \</\> button \* [homework policy](https://discourse.processing.org/faq/#homework) \* [asking questions](https://discourse.processing.org/t/2147)

Sorry, this problem may be a little stupid. I can’t find very detailed steps on the Internet. I tried a code, but I don’t know why it doesn’t work. Please help me and tell me other methods or my coding errors.

void setup() {  
size(600, 600);  
background(255);  
}

void draw() {

strokeWeight(3);  
ellipse(mouseX, mouseY, 100, 100);

}  
void keyPressed() {  
if (key == ‘s’ || key == ‘S’) saveFrame(“#####.png”);  
}

---

<div class="post-metadata">

**Author:** ![svan](https://avatars.discourse-cdn.com/v4/letter/s/82dd89/32.png) [@svan](https://discourse.processing.org/u/svan)\
**Post date:** [May 6, 2022, 5:04am UTC](https://discourse.processing.org/t/please-tell-me-how-to-save-the-processing-file-as-png/36741/2 "2022-05-06T05:04:56Z")

</div>

Your code runs ok on my Mac, as is, after changing the curly quotes which apparently become altered with a copy/paste to the editor. The saved .png file is in the sketch folder. An alternate method would be to place if (keyPressed) {…} inside of draw() function. See [https://processing.org/reference/key.html](https://processing.org/reference/key.html).

```auto
void setup() {
  size(600, 600);
  background(255);
}

void draw() {

  strokeWeight(3);
  ellipse(mouseX, mouseY, 100, 100);

  if (keyPressed) {
    if (key == 's' || key == 'S') saveFrame("#####.png");
  }
}

```
