Making a Transparent Background and Exporting to PNG

Create a PGraphics image to draw it all to then save that,
took off the P2D because it flickers like crazy on my screen for some reason

int horiz = 17;
int vert = 11;
PGraphics img;

void setup() {
  size(720, 480);
  img = createGraphics(width,height);
  background(99, 10, 200,0);

  img.beginDraw();
  img.clear();
  img.translate(30, 30);
  for (int x=0; x<horiz; x++) {
    img.pushMatrix();
    img.translate(x*40, 0);
    for (int y=0; y<vert; y++) {
      img.pushMatrix();
      img.translate(0, y*40);
      img.circle(0, 0, 20);  
      img.popMatrix();
    }
    img.popMatrix();
  }
  img.endDraw();
  image(img,0,0);
  
  img.save("test.png");
}