Skip to content

Instantly share code, notes, and snippets.

@shiffman
Created November 20, 2014 03:06
Show Gist options
  • Select an option

  • Save shiffman/9aca1e105b0631ab234d to your computer and use it in GitHub Desktop.

Select an option

Save shiffman/9aca1e105b0631ab234d to your computer and use it in GitHub Desktop.
Render offscreen high resolution canvas and preview on screen
PGraphics canvas;
void setup() {
size(255,330);
canvas = createGraphics(2550,3300);
canvas.beginDraw();
canvas.background(0);
for (int i = 0; i < 1000; i++) {
canvas.fill(255,100);
canvas.rect(random(canvas.width),random(canvas.height),200,200);
}
canvas.endDraw();
canvas.save("test.png");
image(canvas,0,0,width,height);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment