Loading...
Logo
Processing Forum
I'm loading an svg (though could be an image) into processing and centering it onto the screen (600x600). As I've made my graphic small enough to fit the screen I have no problems but eventually I want to be able to load any svg of any size and have it automatically fit to the size of the screen (proportionally), probably with a bit of a border. Is there any way to do this? I've tried scale() but it doesn't seem to have an option to scale to screen size

Replies(1)

image(img,x,y,width,height); 
width int or float: width to display the image
height int or float: height to display the image

you can use width and height to set the image Size.
If you want it to be the same as your window use width and height, as variable for width and height.
if the image has another proportion you probably have to scale it something like this

image(img,x,y,width,width*"image ratio");