Responsive Image possible?

Hi :slight_smile: I made a sketch on open processing.org and I wanted to send the link to different devices like Mobilephone or Computer with different resolutions. So I gave the canvas the fullScreen(); command.

Now the Problem is, I have an Image in my Code (loadImage) and I wanted to ask if it’s possible to make it responsive and grow with the screen-size.
The way it is now it has the fixed image size that on some devices is too small on some too big so it cuts off elements.

The link to my code is here…
https://www.openprocessing.org/sketch/798127

Thanks to anyone who can help!

1 Like

In the draw method change the image command to
image(img,0,0,width,height);

2 Likes

I tried that but it still doesn’t work for the Phone because the images Resolution is higher than the Phone-Screen it cuts off the half on the Phone.

I think I need a code that transform the images size if the resolution of the page goes down.

1 Like

You last post is the way to go. I suggest you have several copies of the image at different resolutions and after fullscreen() test the width and height to pick/load the best one for your needs

2 Likes