Resize image to fit

A very simple one for someone but I can’t seem to work it out.
How do you resize an image to fit within a square?
I have a number of images all different sizes that I’m putting on a rectangle and i don’t want the images to stretch.

It would also be great to know how to get an image to scale to fill (as opposed to fit) a rectangle.

Thanks for all your help.

hi,

check this out:
https://cables.gl/ui/?rnd=3906#/project/5ce508e89ff311482f4cd089

left: rectangle is resized to fit the aspect ratio of the image
right: image is cropped using drawimage / creating a new square image using imagecompose

cheers

1 Like

Hey @pandur
I found in a few situations where I have some images that are landscape and others that are portrait I often want to key the stretch-axis in the drawimage node so the image scales up correctly to fit within the bounds of a rectangle. It appears this is greyed out so I was wondering if you have a workaround for this?
Thanks
M

I have 6 images, 3 portrait and 3 landscape photographs
and I want to drop them on a rectangle and cycle through them without any cropping.

This should help illustrate.


See what I mean?

Hi KeepItVisual,

Maybe its an idea to use the preset op?
You’d be able to define the state of all the parameters you want on a per image basis.
Here’s a tutorial video

It’s a good work around for some cases but I can see it becoming a little cumbersome in others. I’ve created a feature request to make the stretch axis in drawimage keyable. Thanks a lot @andro.