Array of images

Gewalter Benjamin's icon

Does anybody know of a good way to load lots images into a jitter patch. Maybe even over 100? I know that this could be done with lots of jit.qt.movie or lots of jit.matrix, but that seems pretty inefficient. Does anybody have good suggestions on how to do this? I'm sure its been many times before.

Ad.'s icon

Uzi could help you.
Ad.

Thijs Koerselman's icon

Providing you are able to use slab / GPU processing for that, the most efficient way would be to convert each to a named texture.

You could do this with a javascript for example, iterating over the files in a folder, loading them to a jit.gl.texture and naming each with a unique number.

I've once done this in a patch with hundreds of photo's, and the video memory was the only bottle neck, but that was on a laptop from 2004

Alternatively you could use jit.matrixset, if all of your images are the same size, or combine all of them into a single movie by using one frame for each. I guess it depends on how flexible your content needs to be.

Thijs

Gewalter Benjamin's icon

ah yes, jit matrixset is exactly what I was looking for. thank you so much!

Gewalter Benjamin's icon

I'm trying to combine both of your suggestions right now. So if I want each JPEG to be displayed on a different plane with gl.gridshape, will I need to create over 100 instances of gl.texture and a 100 instances of gl.gridshape? Is there a way to read every image into a single texture and place each one on an individual plane without so many objects?

Rob Ramirez's icon

many ways to go about this.
one of the easiest is to utilize poly~.
depending on your needs, each poly~ instance would contain a gl.videoplane(gridshape, mesh, whatever), and a gl.texture.

you could then hook this to umenu which contains the contents of a folder of images, and iterating through the menu at load time, sending each image to the corresponding poly~ voice's gl.texture.

another method would be, as you suggested, loading image matrices into one gl.texture and using this to texture something like gl.mesh.

andrew's jitter recipe 36, Tiny Video details this process.

i've created a simplified version of that recipe, which loads 16 matrices into one texture, and paints that to a 4x4 grid of quad shapes, using gl.mesh.
would be trivial to hook this to a folder of images instead of the jit.lcd.

Max Patch
Copy patch and select New From Clipboard in Max.

Gewalter Benjamin's icon

rob you're the best! so incredibly helpful.

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