## Picture Tiling - help !

Sep 11 2006 | 8:36 pm
Hi,
apologies in advance for the ugliness of the patch below - I'm new to jitter ! What I'm trying to do is to nicely tile an indeterminate number (probably between 100 - 200) of jpegs (named 1.jpeg, 2.jpeg etc) into a matrix. The patch below does this by scripting a 'glue' with the requisite number of columns / rows and then filling it. However this feels like an unnecessarily slow, clumsy and complicated way of doing it. Does anyone have any better suggestions ??
Thanks,
Richard.
max v2;

• Sep 11 2006 | 9:59 pm
On 9/11/06, Richard wrote:
>
> Hi,
> apologies in advance for the ugliness of the patch below - I'm new to jitter ! What I'm trying to do is to nicely tile an indeterminate number (probably between 100 - 200) of jpegs (named 1.jpeg, 2.jpeg etc) into a matrix. The patch below does this by scripting a 'glue' with the requisite number of columns / rows and then filling it. However this feels like an unnecessarily slow, clumsy and complicated way of doing it. Does anyone have any better suggestions ??
Yes. I'm assuming you know the dimensions of your images before hand
and that they're probably all the same dimension. I would do this
with a javascript. You can JS a movie and do something like this:
var numImages = 200;
var imageDims = [320, 240];
var movie = new JitterObject("jit.qt.movie", imageDims);
var matrix = new JitterMatrix(4, "char", numImages*imageDims[0], imageDims[1]);
matrix.usesrcdim = 1;
matrix.srcdimstart = [0, 0];
matrix.srcdimend = [imagedims[0]-1, imagedims[1]-1];
matrix.usedstdim = 1;
for(var i=0; i < numImages; i++) {
matrix.dstdimstart = [i*imageDims[0], 0];
matrix.dstdimend = [(i+1)*imageDims[0]-1, imagedims[1]-1];
movie.matrixcalc(matrix, matrix);
}
Anyway, something like this should work for you. Keep in mind that I
wrote this code in the email, so it might have some errors, but I
think it gets the idea across. If you want to tile in x and y
dimension use 2 for loops and adjust the dstdimstart and dstdimend
calculations accordingly. I think this will work much much better
than glue and will have the added benefit of being scalable.
wes
• Sep 13 2006 | 12:49 pm
Thanks for this. This looks good but while I think I understand how it's working I've not used JS before and am unsure how to actually implement it ?? I've looked through the JS tutorials - should I put this in a function and then call that function ? Can't seem to get anything to work. Any pointers would be greatly appreciated.
Thanks again,
Richard.
• Sep 13 2006 | 6:53 pm
Another possibility would be to use dstdim and counter to dynamically
change what part of the matrix the frames are written to. The patch
below combines this with a bit of Lobject magic.
Best,
Trond
Richard wrote:
> Thanks for this. This looks good but while I think I understand how it's working I've not used JS before and am unsure how to actually implement it ?? I've looked through the JS tutorials - should I put this in a function and then call that function ? Can't seem to get anything to work. Any pointers would be greatly appreciated.
>
> Thanks again,
> Richard.
• Sep 18 2006 | 9:04 pm
Thanks for this. Until I get more familiar with Javascript I adapted Trond's patch to load up the different jpegs and resize according to how many pictures. Still fairly slow but I guess that's what to expect when loading up 200+ jpegs into a matrix.
Thanks for the help.
Richard.
max v2;