We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello, I like to generate and save large images using processing, much larger than the resolution of my monitor. However, that means that while my sketch is drawing, I can only see part of it.
For example, let's say that my sketch needs to render an image at 4000x4000. When it is done, it saves the image using save(). However, I want to be able to see what's going on as the sketch is being generated, but my screen is only 2560 x 1600.
Is there a way to zoom out so that I can see the entire image while it is been generated, but retain the high resolution I need as a final result?
I realize that I could pre-generate a smaller version, and then let it work on the larger version once I "approve it." However, that does not work for me for various reasons, one of them being that I don't want to do the work twice, even if the first time is at low-resolution.
Any ideas?
Answers
You need to implement your own zoom functions. Explore similar topics at:
https://forum.processing.org/two/search?Search=panning
Kf
If you just want to use your monitor as a shrunk preview (without panning around on a larger surface) then one approach is:
PGraphics pg
pg
image(pg, 0, 0, 1600, 1600)
This will fit the image on your monitor. To center, translate by 480.pg
to disk.This scaling is expensive, so if you don't want the preview to consume too many resources during drawing you could decide to only refresh the preview every %n frames, e.g. once a second -- it really depends on what your preview needs and hardware resources are.
One generic fit algorithm for shrinking any large image to any screen dimensions is to find the ratios of your canvas w/h to image w/h, then scale both sides of your image to whichever is the smaller ratio.