# Save 2 pictures at same time with different stroke & fill parameters

**URL:** https://discourse.processing.org/t/save-2-pictures-at-same-time-with-different-stroke-fill-parameters/43152
**Category:** Beginners
**Created:** [November 5, 2023, 2:24pm UTC](https://discourse.processing.org/t/save-2-pictures-at-same-time-with-different-stroke-fill-parameters/43152 "2023-11-05T14:24:47Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Gabriel](https://avatars.discourse-cdn.com/v4/letter/g/9de0a6/32.png) [@Gabriel](https://discourse.processing.org/u/Gabriel)
#### Post date: [November 5, 2023, 2:24pm UTC](https://discourse.processing.org/t/save-2-pictures-at-same-time-with-different-stroke-fill-parameters/43152/1 "2023-11-05T14:24:47Z")

</div>

Hello,  
I’m not a coder but wish to solve a little problem :  
How do i save 2 pictures at same time with mousePressed fonction with 2 different “stroke” & “fill” parameters

like :

```auto
PImage img; // Variable init
int counter = 1; // moussePressed increment

void draw(){

// the draw code...
  
noStroke(); // condition for pic1
fill(0); // condition for pic1

stroke(0); // condition for pic2
fill (255); //// condition for pic2

// save the pictures
void mousePressed() {
  save("pic1" + counter + ".png");
  save("pic2" + counter + ".png");
  counter++;
}

```

Thanks for anyone who could help  
Gabriel

---

<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: [November 5, 2023, 5:04pm UTC](https://discourse.processing.org/t/save-2-pictures-at-same-time-with-different-stroke-fill-parameters/43152/2 "2023-11-05T17:04:32Z")

</div>

One approach would be to use a PGraphics array and then iterate the array to save the images.  
[https://processing.org/reference/PGraphics.html](https://processing.org/reference/PGraphics.html)

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [November 6, 2023, 2:32am UTC](https://discourse.processing.org/t/save-2-pictures-at-same-time-with-different-stroke-fill-parameters/43152/3 "2023-11-06T02:32:41Z")

</div>

You can also use a command variable to tell the Sketch what to  
do. Name it saveSituation.

Before setup() you say int saveSituation=0;

in mousePressed say  
saveSituation=1;// don’t repeat the word int here

in draw() we evaluate saveSituation with

if… else if… else if…

(or even switch ())

so :

```auto
if(saveSituation==0) {
  do nothing or just draw a standard image 
}
else if(saveSituation==1) {
  set stroke and fill before drawing and draw image1
  save.... 
  saveSituation++;
}
else if(saveSituation==2) {
  set stroke and fill before drawing and draw image2
  save.... 
  saveSituation=0;//reset
}

```

It’s very important to use else if and not only if  
(or use switch())

You can place the image in a function that you call twice (or thrice)

---

<div class="post-metadata">

### Author: ![Gabriel](https://avatars.discourse-cdn.com/v4/letter/g/9de0a6/32.png) [@Gabriel](https://discourse.processing.org/u/Gabriel)
#### Post date: [November 6, 2023, 8:27pm UTC](https://discourse.processing.org/t/save-2-pictures-at-same-time-with-different-stroke-fill-parameters/43152/4 "2023-11-06T20:27:17Z")

</div>

Hello,

Marvelous, it works well.  
Thanks a lot for the help.  
I’m using this “processing” software only for an art-work of mine but i realize how powerful it can be.  
Perhaps i will take a closer look to this.

Cordialement,  
Gabriel
