HELP! Media screen fit proportion

Does anyone know how to fit every media inside of a rectangle without stretching it wrongly?

I want every media to fit inside the rectangle by zooming in.

If you look at the picture, you see that it is stretched out.

To make sure I understand you correctly, what you want is for the pictures to fit in their entirety within the rectangle, but keep their proportions right?
The issue with canvases (and thus rectangles) in spark is that they aren’t squares, whereas spark takes textures as 1024x1024px squares by default, so any image applied to that rectangle will be distorted.

You could counter this by using the 2D Transform pack on the texture in the patch editor before inputing it in the Diffuse slot of the material. Depending on the size of the pictures though, you might have to scale them all down. Not sure if it’s possible to have a one stop solution for every media.

I don’t really understand What you mean. Can you show me an example from the patch editor?

I made a test case to check some bugginess, but in general this is the setup I use. It mostly works. There’s a link to the project on github in this post Detecting gallery texture state changes

1 Like

I’m pretty sure Josh’s answer would be more complete but for the sake of being thorough here is what I meant ^^

The texture is square, however when applied to a rectangle, because of the form factor, my square becomes a rectangle as well. However given that the rectangle is basically the dimensions of the screen, you can divide the length by the width to get the ratio, which is what you want to use to modify the scale.

This set up makes sure that the texture has a square form factor. You’d have to account for the translation as well here, lowering the Y value so it’s centered.

Thanks! I copied the patch editor. It works! But there is one more problem.
The media I upload, has to fill the full screen. It scales proportionately but i need every media to fill the whole canvas.

Do you have a solution for this?

And again. Thanks guys!

@Jaap_Hunting there’s a checkbox named “contain” that you want OFF

I have added the fit2rect patch, but im not sure where to connect the scale patch.

This is my patch right now.

You don’t necessarily need to use the output, just the input. Plug your scale value into the RectScale input on the Fit2Rect patch. I may rework this patch a bit just to make it more clear. I may remove the scale property entirely and use pixel sizes instead

sorry for the dumb questions haha. But where do I get the scale value? How do I plug the scale value into the Fit2Rect patch?
I am still not sure what you mean :sob:

It’s the same scale value you plugged into the gallery

Do you mean like this?:
Still not the result I wanted.
And when i connect them both to the fit2rectscale and Gallery, It stretches again.


So I think I might get rid of the scale input/output altogether. Don’t use those and just use the texture size. I’ll work on this revision tomorrow and try to get something simpler to use. In any case, I think you definitely need to set the texture size to match the size of the gallery texture, which would be coming from the script outputs node

1 Like

AH MAN! I almost lost hope but…
IT WORKED SOMEHOW.

This is what I wanted.
Was this the patch editor what you meant?

Anyway: Thankyou so mutch!


image

2 Likes

Is it also possible to add the sound of the media gallery?

Unfortunately, it’s not possible :frowning: