How to keep proportions in full screen mode?

snowfoot's icon

Hi everyone!

I am trying to project an image (using jit.qt.movie). When I enable full screen, the image stretches to fit the screen. I'm wondering what is the best way to preserve the proportions of the image so it's not distorted? Black or white bars on the sides would work. I am (clearly) new to Max and I've been looking through the forums but I can't find an answer to this question.

Thank you!

Christopher Dobrian's icon

I suggest to:
1) Use jit.displays to determine the width and height of the display where you want to see the movie fullscreen.
2) Set the size of your jit.window those dimensions.
and then either
3) Compare those dimensions to the dimensions of the movie you want to show.
4) Scale your movie by that ratio.
5) Center it in the jit.window.
or
3) Get the dimensions of your movie.
4) Use those dimensions to scale a jit.gl.videoplane to the proper aspect ratio and dimensions to fill the window.
5) Project your video onto the videoplane and render it.

Rob Ramirez's icon
Max Patch
Copy patch and select New From Clipboard in Max.

easiest is jit.gl.cornerpin @preserve_aspect 1:

Christopher Dobrian's icon

Yes. Good example. Thx.

snowfoot's icon

Thanks so much for your suggestions!

For some reason I'm not understanding how to use the jit.gl.cornerpin, though it seems like it should work. Is it because I am not using opengl? My patch is just using jit.xfade to fade from one image (not a video but a still image though I am using jit.qt.movie) to another based on volume from sound input. Its pretty simple. I tried connecting jit.gl.cornerpin to my jit.qt.movie but it either does nothing,or, if I use the piece of code Ramirez sent, it glitches. Sorry I'm unable to be more articulate about what I'm doing. Do either of you know what I might be doing wrong?