I have a basic program where stock images form the background for a larger program - but a number of the images have slightly different sizes compared to each other.
My initial code loads up the background image and tries to set the canvas size based on the image dimensions:
PImage bg;
void setup() {
bg = loadImage("102.jpg");
println(bg.width);
println(bg.height);
wWidth = bg.width;
wHeight = bg.height;
size(wWidth,wHeight);
}
void draw() {
background(bg);
}
I get 'IllegalStateException' error bg.width and bg.height are 806 and 1229, when I include 806 and 1229 instead of wWidth and wHeight respectively, I get the output I want - would I need to declare the size() in a different way? Or would it be simpler to try and resize the jpg files via processing to the same size?