Use PowerShell to Prepare Photos for Time Lapse Movie

24 Apr

If you use Adobe Premiere or Adobe After Effects to convert a set of still photos to a time lapse movie you must import them as an image sequence.

The image sequence requires photos to end with a number which increments, without skipping any digits, throughout the sequence.

If you are using Windows there are a few cool PowerShell techniques you can use to select and prepare photos for import.

Say your time lapse has run for several days, but you only want the daylight photos.  Here is a way we can select all the photos with a timestamp between 8am and 6pm and copy them to a new folder:

gci | Where-Object {$_.LastWriteTime.Hour -gt 8 -and $_.LastWriteTime.Hour -lt 18} | % {Copy-Item $_ ..\working}

You can adjust the time property you examine, or the greater than/less than comparison to get exactly what you want.

Once you have the files you want, you need to rename them into a sequence – here is a command you can run in your folder to rename everything sequentially, while sorting by capture time.

$i = 1
gci | sort -property LastWriteTime | % {Rename-Item $_ -NewName ('{0:D4}.jpg' -f $i++)}

Make sure you do this on a copy of your photos, as you may not want to lose the naming on them.

Both of these commands also assume the last modified date on your photos is correct.  If you have modified them in another application you might also want to try to substitute LastWriteTime with CreationTime.

Tweet about this on TwitterShare on Google+Share on FacebookShare on RedditEmail this to someoneShare on LinkedInShare on StumbleUpon

Leave a Reply

Your email address will not be published. Required fields are marked *