How to save an image correctly?

How do I correctly save my image to a file?

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");
}
1 Like

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

1 Like

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.

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

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/

2 Likes