Matrix stretching and image dimensions?
Hi
In short: I'm loading a bunch of images of different sizes onto a matrix. I don't want the images to be stretched, but maintain their original sizes and aspect ratios instead.
Is there a way to get the original dimensions of the image file, to preform necessary calculations, or which other way is this to be done?
I have already considered making all the files the same size, making use of alpha channel for clearing the edges, but it would be much more convenient, if I didn't have to process the files beforehand.
Maybe [jit.matrix @adapt 1]?
J-F.
Hi Ahto,
Sounds like you have it worked out, but just in case, here's a patch that auto-scales the vidplane according to dim.
best,
Zachary
Ahto wrote on Thu, 26 February 2009 08:31Hi
In short: I'm loading a bunch of images of different sizes onto a matrix. I don't want the images to be stretched, but maintain their original sizes and aspect ratios instead.
Is there a way to get the original dimensions of the image file, to preform necessary calculations, or which other way is this to be done?
Also if you're viewing the images in a jit.pwindow preview, you can change the dimensions of the jit.pwindow using the size $1 $2 command. This way it'll display with the right dimensions. Sometimes if things are stretched weirdly, the internal dimensions are OK, but they may be stretched in the jit.pwindow and look strange, leading you to think (incorrectly) that something is funky with the image. To save space on the screen you could divide each dimension by 2 before the size command, and things should still look fine.
hi -
i have the same request (view images appropriately scaled in a jit.window) but i cant follow exactly the steps suggested to solve it. could someone perhaps upload a simple solution?
thanks,
josh
Hi Joshua,
Didn't I provide a solution above? Well here's another one that automatically decides whether to letterbox or pillarbox the video based on the movie dim and the window dim. Hope it helps.
best,
Zachary
hi -
thanks so much. for some reason i couldn't get the first patch you loaded to work but the most recent one works perfectly.
realy appreciate it.
josh
Hi Josh,
Probably what was happening with the first one, was that the [loadmess 1] wasn't sending when you pasted it into a new patch. You can double-click on it to send, or basically just change the scale value to something other than 0. Then it should work. But that patch is a slightly different approach to scaling, each will be useful in different contexts.
best,
Zachary
Hello,
I am trying to do the same thing, but instead of using a jit.qt.movie, my images are loaded into a jit.matrixset
Is there a way to get an image's dimensions once it is loaded into a matrix?
Thanks Zachary for your patches btw.
Florent
@FLORENT GHYS
yap
`
oh thanks Tada!
I couldn't find any mention of a "getdim" message in jit.matrix reference file.
it's my understanding that jit.movie won't report dimensions (dim) if you read in a jpg or png file? i've tried the above method using 'getdim' and it only outputs if it's a quicktime movie, not an image file.
Hi to all !
Zachary thanks for your scale patch that's what I was looking for ! A small question still : I'm quiet new on Max and I'm looking to send the re-scale pictures into a jit.xfade object. If I just use the matrix output from the jit.gl.videoplane of your patch I get and colored gradient but not my picture... I can't fide where the re-scaled matrix is correctly output except in the jit.window you've put in the patch... Can you help ?