Best ways to manage a canvas larger than the screen size?

Hi!

I am new to Processing and having a lot of fun with it. I have developed a few algorithms I like and that I now want to try printing as a piece of physical art. So far, all of my work has been with a processing resolution size smaller than my current screen size (e.g. I might use size(800, 800) on my ~1600 x 1000 display). But, now I want to run my processing programs with a much larger size - e.g. size(4000,4000) - to ensure I get a high enough resolution output for a print.

My challenge is that, if I call size(4000,4000), while my computer does properly generate the larger Processing canvas, I can’t see it all on my screen. While I can drag the top left and right in order to at least see the top of the processing canvas, which is okay though non-ideal, I can’t pull it “up” on a Mac at all, and so there is no way for me to see the middle or bottom of the canvas whatsoever while the program is running. This makes it very hard to identify when to stop the program and save the image.

What are the best strategies for dealing with this? Perhaps there is an optimized way to save the processing file at a lower size(X, Y) value, and then scale it up in a way that preserves fidelity/clarity (e.g. is it possible to save as a vector file that scales perfectly)? Or, is there a way to have Processing run on a larger size(X, Y) value but be “minimized” to fit within my display? I would love any advice or thoughts.

1 Like

I use a PGraphics of whatever size I want, and I do all of my drawing to that PGraphics based on its size, completely independent of the window size. Then I draw the PGraphics to the screen.

More info in the reference here: https://processing.org/reference/PGraphics.html

2 Likes

There are many ways of approaching this, depending on your target output. If you are doing vector-style artwork, you might want to keep the existing coordinate system and use e.g. PDF output. You can also scale() before drawing, but skip scale on an export frame.

A more general robust approach is to draw to a PGraphics, then display on the canvas with image(). Now you can make the PGraphics literally any size and resize (or crop, scale, etc.) it in your canvas preview.

2 Likes