We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Say have a background image named img. I get exceptions when I do : size(int(img.width), int(img.height));
Is there a way I can automatically set the size of the application window based on the background image W and H?
FYI, background is a PShape stored in an SVG file.
Answers
Works fine for me...
Thanks TfGuy44 but that doesn't work. I think for the background I should not be using PShape and must use PImage instead!
Works fine for me... Uses the bot1.svg that comes with Examples > Basics > Shape > LoadDisplaySVG
OK it works now. Thanks for the tip!
Just an extra caution: Processing re-runs the code above size(). @-)
In order to avoid re-loading files unnecessarily, check whether it's still
null
: *-:)Alternatively we can check either width or height are still set to their initial default values: O:-)
if (width == DEFAULT_WIDTH) bg = loadShape(SVG);