Hello,
I need to convert a PGraphics into a Pimage in the same script.
I tried using the following command, where pg is the elaborate graphics, but it didn’t work:
PImage img = pg.get ();
Any suggestions?
Thanks in advance
Hello,
I need to convert a PGraphics into a Pimage in the same script.
I tried using the following command, where pg is the elaborate graphics, but it didn’t work:
PImage img = pg.get ();
Any suggestions?
Thanks in advance
pg: get() and copy() both work for me.
maybe the issue is somewhere else?
PGraphics pg;
void setup() {
  size(1100, 333);
  pg = createGraphics(40, 40);
  //
  pg.beginDraw();
  pg.background(100);
  pg.stroke(255);
  pg.line(20, 20, 37, 134);
  pg.endDraw();
  //image(pg, 9, 30); 
  //image(pg, 51, 30);
}
void draw() {
  PImage img = pg.copy ();
  //PImage img = pg.get ();
  image(img, 51, 30);
}
            A PGraphics is already a PImage.