Loading a .PNG image into PGraphics

Is there a very simple way of loading an image into PGraphics?

I’m currently rendering direct to PGraphics and saving this as an image file:
“1.PNG”
If I want to continue the render, I need to load this image back into PGraphics and continue with render.

Any ideas?? And any position / scale options available.

Thanks in advance.

See pgraphics reference

https://processing.org/reference/PGraphics.html

As for scaling

https://processing.org/reference/scale_.html

Which must be used in combination with matrix pop and push.

https://processing.org/reference/pushMatrix_.html

void draw() {
  pg.beginDraw();
  pg.background(100);
  pg.stroke(255);
  pg.image(img, 0,0);
  pg.endDraw();
  
}

Where pg is your pgraphics object and img is a pimage object.
Sorry i cant offer concrete examples, currently using my phone.

Thank you so much!!
Works perfectly.

What I am currently working on:

1 Like