Resize background image

Hi everyone,
I have created an image (1920 x 1080 px) for my background. When I open the the file in another laptop that has a lower window size, then I get problems running the file. I wonder if there is a way to resize the background image.

PImage background;
void setup()
{
     size(displayWidth, displayHeight);
     background = loadImage("fondo.png");
     image(background,0,0,displayWidth, displayHeight);
}
void draw()
{
}

1 Like

then I get problems running the file

Problems how? Looks the wrong dimensions, low resolution, black edges? Sketch crashes? Something else?

void setup()
{
     size(displayWidth, displayHeight);

Use settings() for this. Do you want to fullscreen()?

https://processing.org/reference/settings_.html
https://processing.org/reference/fullScreen_.html

If you are trying to display a fullscreen sketch with a background image on screens with different aspect ratios then you need to decide what should happen – should it stretch, or constrain aspect ratios to width, height, longest, or shortest dimension?