# How to save an image correctly?

**URL:** <https://discourse.processing.org/t/how-to-save-an-image-correctly/17638>\
**Category:** Beginners\
**Created:** [February 8, 2020, 12:21pm UTC](https://discourse.processing.org/t/how-to-save-an-image-correctly/17638 "2020-02-08T12:21:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![maxrussell](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@maxrussell](https://discourse.processing.org/u/maxrussell)\
**Post date:** [February 8, 2020, 12:21pm UTC](https://discourse.processing.org/t/how-to-save-an-image-correctly/17638/1 "2020-02-08T12:21:42Z")

</div>

How do I correctly save my image to a file?

```auto
void setup() {
  size(312, 161);
  //size(624, 712);
  img1 = loadImage("spaceodyssey.jpg");
  img2 = loadImage("spaceodyssey.jpg");
  img1.filter(POSTERIZE, 7.5);
  img1.filter(ERODE);
  img1.filter(BLUR);
  img2.filter(INVERT);
  save("output.jpg");
}

```

---

<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:** [February 8, 2020, 12:40pm UTC](https://discourse.processing.org/t/how-to-save-an-image-correctly/17638/2 "2020-02-08T12:40:25Z")

</div>

you are working with 2 different images without displaying them

- what you do now: save saves the screen (which is empty)

- **instead** say `img2.save("output1.jpg");` - this tells the img2 to be saved

---

<div class="post-metadata">

**Author:** ![bucherjo](https://avatars.discourse-cdn.com/v4/letter/b/848f3c/32.png) [@bucherjo](https://discourse.processing.org/u/bucherjo)\
**Post date:** [February 8, 2020, 12:45pm UTC](https://discourse.processing.org/t/how-to-save-an-image-correctly/17638/3 "2020-02-08T12:45:30Z")

</div>

Hello maxrussel  
You need to add a  
image(img,xCoordinate,yCoordinate);  
line to display your image on the screen which then gets saved to your output.jpg file.

---

<div class="post-metadata">

**Author:** ![maxrussell](https://avatars.discourse-cdn.com/v4/letter/m/a88e4f/32.png) [@maxrussell](https://discourse.processing.org/u/maxrussell)\
**Post date:** [February 8, 2020, 1:16pm UTC](https://discourse.processing.org/t/how-to-save-an-image-correctly/17638/4 "2020-02-08T13:16:35Z")

</div>

thank you - how would I save what’s actually displayed in the output frame though? And/or, possibly combine both images?

---

<div class="post-metadata">

**Author:** ![bucherjo](https://avatars.discourse-cdn.com/v4/letter/b/848f3c/32.png) [@bucherjo](https://discourse.processing.org/u/bucherjo)\
**Post date:** [February 8, 2020, 1:44pm UTC](https://discourse.processing.org/t/how-to-save-an-image-correctly/17638/5 "2020-02-08T13:44:06Z")

</div>

Hello maxrussell  
You can display multiple pictures on your canvas by simply using the image(); method more than once. If you want to edit the pictures before printing them to the canvas you can use methods like tint, saturation etc. There is a detailed description of all Processing methods here:  
[https://processing.org/reference/](https://processing.org/reference/)
