Eternalism & the art of slitscanning

Eternalism is a philosophical view on reality that proposes time is just another dimension. As opposed to the view of the world as a three-dimensional space modulated by the passage of time. An interesting facet of eternalism is that it implies future events are “already there” and as such that there is no objective flow of time. One can argue about the truth of such a theory in the real world. With regard to the world of film, it is most certainly true. When the viewer starts the film, the ending is already there. So the perceived spatial dimension and the perceived temporal dimension, are truly equal. This creates the possibility to view everything in a non-conventional way.

The manipulation of time
Wasn’t this blog about Processing? Yes it is! So let me get right to point. Time bending experiments in Processing, the possibilities are endless! Visually that is. ;-) I’ve been working on a series of sketches that mess with the flow of time in some way, shape or form. Ranging from manipulations at the frame level, all the way down to the very pixels that images are made of. I have no idea what you would normally call these effects. But for myself I used names like TimeMatrix-based VideoSequencer and pixelTimeDisplacement (preliminary screenshot below). More than just cool names, they’re actually a fairly decent representation of the functionality. Perhaps later I will release, write or show material related to these experiments. The focus of this blog post however will be on the technique I used to make the video above.

Slit-scanning
The term slit-scanning has it’s roots in the history of the technique. Back in the days, the process would supposedly be as follows. A moveable slide, into which a slit had been cut, was inserted between the camera and the subject to be photographed. Making one single slit-scan photograph would thus require a whole series of shots. You can imagine this was extremely time-consuming. Over the years, technological advances have not only made it cheaper, easier and faster to create slit-scan photography, but also allowed for creation of and experimentation with slit-scan video art. A great catalogue of the latter is maintained by Golan Levin. So check out this page to see some inspiring examples. You can also find a simple slitscanning sketch for Processing there, which works very similar to the old-school techniques I just described.

Existing code
We have computers now to do all the heavy lifting (yay for the digital age 8)). And there are quite a few code examples out there to get started with slit-scanning. Although a good starting point, none of those were unfortunately completely suited for what I had in mind. Which was full HD slitscanning of existing image sequences. The two biggest problems for me with existing sketches: they were fairly slow to process frames or incapable of processing large files altogether due to memory restrictions. So these were the two points I focused on when developing different prototype sketches. What I ended up with ain’t perfect, but it’s good enough for the job at hand. Also, the learning process itself is still my most important goal. Of course solid software and pretty pictures are a big bonus! :D The final sketch works in batches and uses the maximum amount of memory it can use for a single batch. So it works regardless of the size and number of images. A small video can be processed in a matter of seconds in a single batch. If you’re processing a longer sequence of full HD images, it can take around two hours, depending on your computer and memory limit. However in my opinion this is pretty reasonable. Plus the added advantage of batches, is that after the first batch (10 minutes even with full HD) you’ll already be able to see the first series of resulting images. And decide if you wanna see the rest. :P

SlitsP5
In the spirit of open-source I like to share the code I wrote. For lack of a better name, let’s refer to it as SlitsP5. You can download it from here. Of course I release my code under the usual disclaimer. That it was created as a personal experiment by yours truly. So there are no guarantees it actually works, haha. ;-) For your convenience I placed almost all of the code in a class, so it becomes really simple to use it. Aside from the aforementioned class, the code example below is the only thing you need to run it (this is all included in the download, no need to copy-paste). As you can see there aren’t many settings, just state the directory and the direction of the slit-scanning (X or Y) and that’s basically it. Some settings hidden in the class itself are a boolean for saving (true by default) and one for additional console output (false by default). I put them there, cause they’re unlikely to be used anyway. I’ve experimented with video and image sequences for both input and output. But in the end I found video unreliable (fps, codecs and whatnot), so I switched fully to image sequences for both input and output. For me there are a number of advantages to this like accuracy, flexibility and quality. The downside being the need to separately convert between video and image sequence. Of course it’s possible to rework this sketch to include direct video input and output.

SlitsP5 mySlitscan;

String directory = "inputDirectory";
char direction = 'X';
int memBarrier = 320000000;

void setup() {
 size(500,500);
 mySlitscan = new SlitsP5();
}

void draw() {
 mySlitscan.run();
}

Setting the memBarrier
With regard to settings, the only really important thing is to correctly set the memBarrier. You only need to do this once. The memBarier is the maximum amount of pixels your computer can hold in the memory at one time (given the Processing/Java/WinXP memory limitations). So this is different per computer. For me it was about 360 million, so I set the memBarrier at a secure 320 million. A little less won’t have a huge impact, but if you set it too high, you’ll get an out-of-memory error right at the start. I’m pretty sure there is a neater way to manage memory, but since you only need to do this once, it’s not a whole lot of work. :-) So how do you find your memBarrier? Well, for your convenience another sketch – called memBarrierTest – is included in the download. Run this program until it crashes. Yes, crashes. Then scroll up a little in the console and see the last line that says something like “Number of pixels in memory: 363.250.000”. That’s the number you can use for the SlitsP5 sketch. Just to be safe you can even set it a little lower.

How to use SlitsP5
Using SlitsP5 in four steps (assuming a correct memBarrier is set):

  1. Place the input image sequence in a subdirectory in your sketch directory.
  2. State the name of the directory in the sketch (images will be read automatically).
  3. State the direction you want to slit-scan (X or Y).
  4. Run. You will see information and a progress indicator in the console as well as the main window. Output images are saved in a subdirectory of the same name as the input directory with the addition of either an X or an Y, depending on your slit-scan direction.

Tips, tricks & troubleshooting
A collection of useful suggestions to help you on your way:

  • SlitsP5 automatically reads JPG, PNG and TGA images from the input directory. If you want to use other image formats, it’s fairly easy to add them to the class (as long as they can be read by Processing in the first place). You can add other filetypes in the loadFilenames() function.
  • Remember that the number of frames will be your new X or Y dimension. For example if you have 100 input images of 200 x 200 pixels and you slit-scan over the X. You will end up with… 200 images of 100 x 200 pixels. That is slit-scanning. A spatial dimension switches places with a temporal dimension. So if you wanna end up with full HD width (1920 pixels) you will need to input exactly 1920 frames.
  • Footage with big cuts and/or compilations doesn’t work well. As you can imagine, sudden changes stand out in slit-scanned material. Slow moving objects on the other hand create much smoother output.
  • If you get an outOfMemory error right at the start, you need to correctly set the memBarrier! ;-)

Inspiration
For anyone interested in slit-scanning, I can recommend the 1988 experimental short film The Fourth Dimension by Zbigniew Rybczyński, a filmmaker and innovator in the technical field. Aesthetically the video I made was also influenced by the work of Pipilotti Rist, an amazingly talented video artist. I was – unexpectedly – introduced to her wonderful art on my visit to the Fundació Joan Miró in Barcelona. Last but not least an obvious source of inspiration were the works of previous Processing tinkerers such as Don Whitaker, Lukasz Karluk and Matt Ditton. Don Whitaker also happens to be the man behind Mother Nature Videos. This is one of the few online collections of free quality HD stock footage, which is perfect material for slit-scan experimentation.

Looking back, looking forward
It’s becoming kind of a blog post tradition to reflect upon the whole creative & educational process. With each project, I just feel that my grasp of programming in general and Processing in particular is growing. Which is of course great. I do notice that despite my best efforts, my to-do-list is even growing faster! :D The more you know, the more you realise you don’t know. There are numerous areas of interest that I’d like to investigate. I just try to go from one to the next intuitively, so we’ll see what happens… I hope this post, video and/or source code is useful to someone out there. And please feel free to talk back in the comments below. :-)

You can download SlitsP5 from here.

Advertisement
Comments
22 Responses to “Eternalism & the art of slitscanning”
  1. Eli says:

    hello,

    after finding ure site i was so impressed with processing that im addicted to it for the past week, but of course i’m still at the begining. i actually wanted to experiment with the slitp5 code u have and ive tried it but i think there is a problem. my input images are of 1920/1080and then the output that comes out is much smaller 248/1080 . and it doesnt really look like much so i was wondering how you managed to do what you did. it would be great if you could help.

    E

    • Amnon says:

      Hi Eli,

      See tip 2 above. Slitscanning means a spatial dimension (in this case 1920 pixels width) is replaced by a ‘temporal’ dimension (in this case 248 images). If you want the output to be 1920 pixels wide, you need to input exactly 1920 images. Because the NUMBER of images (not the original width) determines the final width of your output. The original width of your input images will determine the number of output images (in this case 1920 images). You can precalculate everything, start from your intended output and work backwards. When slitscanning over Y it’s the same except with regard to height. For simplicity I usually just input 1920 images at at resolution of 1920×1080 and slitscan over the X. Then you end up with the same. ;-)

  2. Marco says:

    Hello! Great Work for both (video & script)!
    I noticed a problem, when I set “y” slit axis (char direction) the program start an endless processing series (1/0,2/0,..etc etc) and doesn’t save anything!
    Can You help me out?

    P.S.
    Sorry for my english, and i’m a newbie in Processing!

    Looking forward for an asnwer!
    Thank you
    Bye

  3. David Ayre says:

    Hi Amnon, thanks for sharing your work, very impressive. I’m really interested in this technique and as a photographer I have tried similar things with still images. I have decided that video is the way to go.

    What I want to do is shoot some HD video, grab a 1 pixel wide vertical strip from the left side of the first frame, then another 1 pixel strip from the second frame at pixel 2, etc. I would want these to be put in a folder in sequence so that I can join them all together to make a single image. Is it possible to do this with your code? if not, can it be modified to do it?

    I can save my video frames as jpgs first no problem.

    I think your version is probably the best I have seen so far and is not far from what I want to achieve – I think. Cheers, DAVE.

    • Amnon says:

      Hi Dave,

      This is indeed very close to what this code does, in fact it’s easier. To let the pixel strip correspond with the frame number, would require only minor alteration. And if I understand you correctly, your intended output is one single image, which is as wide as the number of input frames. Outputting a single image is obviously in many ways easier to handle than the above app which needs to output many images. So what you describe is very much possible and could code-wise be even shorter and faster. Also, the output image could be joined by the program immediately, unless you need single-pixel strips for another reason. My guess is that it would take an efficient program minutes to generate one single image -as you describe- from a series of input frames.

      Best,
      Amnon

      • Jonny says:

        Hi Amnon,

        I want to do something similar to what Dave has described, any advice on how to modify the code to do this?

        Cheers
        Jonny

      • Amnon says:

        Like I said, what you guys want to do is actually much simpler because you only output a single image. At the start create a PImage that is as wide as the number of input images. Then just go trough each input image, extract the line you need into the output image buffer (even the placement doesn’t change). If the pixel array confuses you, you can use get() for your first attempt. Once you’ve gone through all of the input images, you will have completed your output image. Perhaps you can use some snippets from my code, but it may be even faster to just write it yourself.

  4. Justin Hantz says:

    Hey Amnon, I’m a newbie to processing and I dont know how to get my image sequence into Slitp5! how do I “State the directory” I have a folder that contains my image sequence rendered out of final cut. PLEASE HEEEELLLLPPPP

    • Justin Hantz says:

      I keep changing the word “inputDirectory” to the name of the folder that I have my images in. then i get this error message

      Exception in thread “Animation Thread” java.lang.NullPointerException
      at SlitsP5main$SlitsP5.determineVariables(SlitsP5main.java:120)
      at SlitsP5main$SlitsP5.(SlitsP5main.java:75)
      at SlitsP5main.setup(SlitsP5main.java:37)
      at processing.core.PApplet.handleDraw(PApplet.java:1608)
      at processing.core.PApplet.run(PApplet.java:1530)
      at java.lang.Thread.run(Thread.java:613)

      • Amnon says:

        Put the whole directory with your images inside the directory of the SlitsP5 sketch. So your inputDirectory should be a subdirectory of the sketch’s main directory (just like the data folder which can be used to place your input for general Processing data). In your sketch you replace inputDirectory with the NameOfSubdirectory. It’s relative, do not put the full path in there. So you should only use the name of the direcory you want to use.

        On a side note, I’ve been working on a second version of this Slitscanner which does take absolute paths, so then you don’t have to move/copy the images. However in this version that you use, it’s not yet implemented. So again, copy/move the image directory inside your sketch’s main directory and then put the name of that subdirectory in the sketch.

        Good luck! :D

  5. Renata says:

    Hi Amnon, I´m really interested in having an video output with your script.
    The code is running but, it only saves the splits images in the file.
    I don´t know how to get them to compose a video like your exaple here. Could you help me?

    • Amnon says:

      Hi Renata,

      As you’ve noticed both the input and output for this sketch are image sequences. This is a conscious design decision on my part. To create a video from a sequence of images you will need to create another sketch or use another program, for example Quicktime PRO or After Effects. There are many programs available that can turn your image sequence into a video.

      Best regards,
      Amnon

  6. Scott R says:

    Hi Amnon,
    Great article and a great tool!

    I was wondering how this is different from the effect shown in this video: http://vimeo.com/3697348

    I’ve seen this similar effect called “slit scan” and but also “time displacement” (after the crude After Effects tool).

    Is there a simple way to modify your sketch to output an image sequence in which the appearance of each line of pixels is staggered from left to right, or top to bottom (etc.) in this way? I know the two effects are related but I can’t tell what the different variables are here.

    Thanks,
    Scott

    • Amnon says:

      Hi Scott,

      Yes, these are the two broad effects that fall under the term slitscanning. In July I finished a program that incorporates both types of slitscanners (and some other improvements like memory management). For lack of a better term, I call one DimensionalSwap and the other TimeOffset. The first is what SlitsP5 did and what you see in my video… a temporal and a spatial dimension are swapped. The second is what you are talking about and what that linked video shows… certain pixels (usually lines from top to bottom) are delayed. So the top of the screen is realtime and the bottom of the screen is “t-height”, causing the time displacement effect (actually the yellow-pink screenshot above is also an example of this type of slitscanning). Unfortunately there is no simple way to modify the SlitsP5 code to change the effect. The good news is that the time displacement effect runs much faster, basically in realtime.

      My original intent was to release this program with a new video + big writeup, but as usual other things got in the way timewise… ;-) Also I’m not sure yet how I will release it. As a library, a sketch or an application. So I’m pretty sure it will come out (with a video and possibly a PDF showcasing / explaining it’s possible use). I just don’t know when.

      Best,
      Amnon

Trackbacks
Check out what others are saying...
  1. [...] ONEEIGHTNINE® Original: SlitsP5 | SlitsP5:Eternalism blog comments powered by Disqus [...]

  2. [...] were either afraid of the learning curve or simply disappointed with the HD options out there, then this is the script for you! It’s really quite an easy process to perform.  Even if you have no experience with Processing [...]

  3. [...] wanted to test out this new and exciting slit-scan Processing script that designer Amnon Owed created.  I went searching for whatever video I already had on my computer.  Since the creativity project [...]

  4. [...] sent the shot through Amnon Owed’s awesome slit-scan processing script twice.  Once running on the X-axis and the other on the Y.  Due to the large number of frames [...]

  5. [...] http://amnonp5.wordpress.com/2011/01/16/eternalism-the-art-of-slitscanning/ Tags: generative, processing, slit-scan Posted on Sunday, May 15th, 2011 at 4:00 pm , filed under [...]

  6. [...] 2011 · Leave a Comment  Just a quick update with some exciting news. My short film Eternalism was selected for two festivals. It’s really amazing to me! I still have so much to learn and [...]



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.