Forums > Jitter

Matrix stretching and image dimensions?


Feb 26 2009 | 2:31 pm

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.

Feb 26 2009 | 4:47 pm

Maybe [jit.matrix @adapt 1]?
J-F.

Feb 26 2009 | 6:30 pm

OK, I’ll load the image with @adapt">’@adapt 1′ set, then poll the matrix with ‘getdim’ and go from there – works alright, thanks!

Now I just want to check one more thing. I’m also working with jit.gl.videoplane. The ‘scale 1. 1. 1.’ is in relation to the render context dimensions?

Feb 26 2009 | 7:04 pm

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

— Pasted Max Patch, click to expand. —
Feb 27 2009 | 1:24 am
Ahto wrote on Thu, 26 February 2009 08:31
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?

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.

May 17 2009 | 10:39 pm

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

May 20 2009 | 1:16 pm

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

— Pasted Max Patch, click to expand. —
May 20 2009 | 6:34 pm

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

May 20 2009 | 9:59 pm

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

Aug 14 2014 | 9:07 am

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

Aug 14 2014 | 9:34 am

@FLORENT GHYS
yap

`


-- Pasted Max Patch, click to expand. --

  • This reply was modified 2 years by  tada.
Aug 14 2014 | 9:55 am

oh thanks Tada!

I couldn’t find any mention of a "getdim" message in jit.matrix reference file.

Viewing 12 posts - 1 through 12 (of 12 total)

Forums > Jitter