How can I automate Photoshop to build a slit-scan image from a timelapse sequence?

Asked 1/19/2011

4 views

2 answers

0

I have around 1,000 sunset photos shot a few seconds apart. I want to create one final image by taking a 4-pixel-wide vertical strip from each frame and placing those strips side by side, so the scene changes gradually from left to right. In other words, strip 1 comes from photo 1, strip 2 from photo 2, and so on.

A standard Photoshop action does not seem flexible enough because the selection position needs to change on each iteration. Is there a practical way to automate this in Photoshop?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

15y ago

2 Answers

8

You're going to need to get into loops and variables within the script to do it. Assuming the files are named sequentially as most sane cameras would generate them, then it would look roughly like this at the 50,000' elevation:

//control variable, counts which photo you're on
var lcv = 0;

//how many photos are there?
var numPhotos = 1000;

//used to track the name of the file in the loop
var filename;
//used to track the shape to cut in the loop
var shapeRef;
//used to track the left and right edges of the slice
var leftEdge;
var rightEdge;

//main processing loop
for (lcv = 0; lcv < numPhotos; lcv++ ) {
    // process one image.
    filename = 'img_'+(lcv + 1234)+'.jpg';

    //open the file here... get it ready to cut from
    ...

    //create the selection box here, we'll use the LCV to control how far over we move
    leftEdge = lcv * sliceWidth;
    rightEdge = leftEdge + sliceWidth;
    shapeRef = [ [leftEdge, 0], //upper left
                 [rightEdge, 0], //upper right
                 [rightEdge, 3400], //lower right
                 [leftEdge, 3400] ]; //lower left

    // use the above shapeRef to first cut from the above opened file, then paste it into your master file.

    // close the file you opened above so we can move on to the next file

}

I've made some assumptions above:

  1. you're coding in JS
  2. first image is number 1234, and they go in order, with names like "img_1234.jpg"
  3. the file is 3400 pixels tall.
  4. you already know how to open the image, cut the slice out and paste it into another image. :)

If the first couple aren't legit assumptions, adjust the code as needed. ;)

If you need more help with the syntax of using variables, two references come to mind:

  1. Adobe's Excellent intro scripting guides
  2. W3 school's JS resources or the Mozilla Developers Center's JS section

Originally by user1872. Source · Licensed CC BY-SA 4.0

user1872

15y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

Yes. A Photoshop action alone is usually too limited for this because the selection has to change on every iteration. The workable approach is to use a script with a loop and variables.

The community solution was to script Photoshop so it:

  • creates a new destination document,
  • opens each source image in sequence,
  • selects a 4 px vertical slice,
  • copies/pastes that slice into the output document,
  • offsets the paste position for each new frame,
  • repeats for the full image sequence.

This is essentially a slit-scan workflow. As long as your files are named sequentially, a script can step through them automatically. One answer outlined the logic in JavaScript-style pseudocode using a loop and variables for filename, left/right slice edges, and image count. The asker then confirmed success with a Photoshop CS5 AppleScript that opened each file, extracted slices, and assembled the final image.

So: yes, it can be automated in Photoshop, but you’ll want scripting rather than Actions.

UniqueBot

AI

15y ago

Your Answer