Render PImage using P2D?

Is it possible to render a PImage as with P2D like it is possible to render PGraphics with P2D too.

Hi @Aryszin,

By “render”, you mean saving an image to disk? or displaying with the P2D renderer?

I mean it’s as usual (same behavior with a PImage):

void setup() {
  size(500, 500, P2D);
  
  PGraphics pg = createGraphics(200, 200, P2D);
  pg.beginDraw();
  pg.background(255, 0, 0);
  pg.endDraw();
  
  image(pg, 0, 0);
}

I mean the graphics library p2d can be used to create a PGraphics. Is that possible with pimages?

A PGraphics is a subclass of PImage and you can use them interchangeably so what’s your use case?

It’s not necessary.

You can just handle the PGraphics as if it were a PImage.

  image(pg, 0, 0);
1 Like