We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Sorry for the newbie question, but here goes: I am trying to get the display size() to adjust to the loaded image. My code is the following:
void setup()
{
img = loadImage("Typist.jpg");
size(img.width,img.height); //set the window size to match the image
}
where "Typist.jpg" is in a "data" folder. I get the following error:
"The size of this image could not be determined from your code. Use only numbers (not variables) for the size() command. Read the size() reference for more details"
If I put numbers in in place of .width and .height it works just fine. I see lots of examples where code just like that works. Any suggestions? Thanks.
Answers
https://Processing.org/reference/settings_.html
Hooray! Thanks! void settings() { img = loadImage("Typist.jpg"); size(img.width, img.height); }
But very cofusing because it says specifically not to use loadimage in settings. Also I would like to define a global array using img.width....but seems not sure I can actually do that.