I can`t load an Image as background.
Exception in thread “Thread-212”
void setup() {
size( 1366, 768);
PImage bg;
bg = loadImage("qrC6FvL.jpg");
}
void draw() {
background(bg);
fill(0, 255, 0);
rect (300, 300, 300, 300);
textSize(32);
fill(0, 51, 0);
text("WAHR", 400, 450);
fill(255, 0, 0);
rect (700, 300, 300, 300);
textSize(32);
fill( 128, 0, 0);
text("FALSCH", 800, 450);
}
2 Likes
kll
2
-a- the variable bg should be global declared, above setup()
( but loaded in setup() ( correct ) )
-b- be sure that the picture size fits to the canvas size or
background(bg);
will not work.
can use resize();
look here first,
https://processing.org/reference/image_.html
1 Like
this doesnt work either: @kll
PImage bg;
void setup() {
size( 1366, 768);
bg = loadImage("qrC6FvL.jpg");
}
void draw() {
background(bg);
fill(0, 255, 0);
rect (300, 300, 300, 300);
textSize(32);
fill(0, 51, 0);
text("WAHR", 400, 450);
fill(255, 0, 0);
rect (700, 300, 300, 300);
textSize(32);
fill( 128, 0, 0);
text("FALSCH", 800, 450);
}
This code looks good to me
What doesn’t work exactly?
kll
5
i asked you to check the size / or much better /
- instead with
background(bg)
- start with
image(bg,0,0);
to see what you got