Skip to content

Instantly share code, notes, and snippets.

@dkgrieshammer
Created August 29, 2023 15:57
Show Gist options
  • Save dkgrieshammer/fe22e8634e032f711aa3fc21749a0ddf to your computer and use it in GitHub Desktop.
Save dkgrieshammer/fe22e8634e032f711aa3fc21749a0ddf to your computer and use it in GitHub Desktop.
P5js hack to adjust export for printing
// P5js hack to adjust export for printing.
const exportScale = 4;
function keyPressed() {
if (key == 's' || key == 'S'){
pixelDensity(exportScale);
draw();
let fileName =
"yourP5project_" + year() + "_" + month() +
"_" + day() + "_" + hour() + "_" + minute() +
"_" + second() + ".png";
saveCanvas(fileName);
pixelDensity(1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment