Array of images

    May 22 2009 | 8:57 pm
    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 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.

    • May 22 2009 | 9:10 pm
      Uzi could help you.
    • May 23 2009 | 12:01 pm
      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 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.
    • May 24 2009 | 12:07 am
      ah yes, jit matrixset is exactly what I was looking for. thank you so much!
    • May 24 2009 | 6:01 pm
      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?
    • May 24 2009 | 8:14 pm
      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.
    • May 24 2009 | 8:27 pm
      rob you're the best! so incredibly helpful.
    • May 25 2009 | 9:43 am