Writing a macro to create several .avi sequences from many images

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Writing a macro to create several .avi sequences from many images

nhebbani
Hey everyone,

I have a folder containing 2024 images, and I was hoping to write a macro that would create an .avi file for the first 253 images, then move on to the next 253 images and continue through the folder in this way.
I'm fairly new to writing code. I've worked on two macros that have worked with varying degrees of success, and most of what I've got is from the macro recorder and from what I could find on other forum posts:
(1)

filepath=File.openDialog("Select a jpg File")
dir1 = File.directory;
list = getFileList(filepath);
dir2 = getDirectory("Choose Destination Directory ");
numberSlice=253;
setBatchMode(true);
for (i=0; i<list.length; i+253) {
    showProgress(i+1, list.length);
    open(dir+list[i]);

    run("Image Sequence...", "open=[&filepath] number=&numberSlice starting=1 increment=1 scale=100 file=[.jpg] sort");
    saveAs("AVI", dir2+list[i]);
    close();
}

(2)

filepath=File.openDialog("Select a jpg File");
numberSlice=253;
run("Image Sequence...",
  "open=[&filepath]"+
  " number="+numberSlice+
  " starting=1"+
  " increment=1"+
  " scale=100 "+
  "file=[.jpg] "+
  "sort");
dir = getDirectory("Choose Destination Directory");
name = dir+getTitle();
save(name+".avi");
close();
run("OpenNext...");

If it will work better/easier to write, then I can put each lot of 253 images into subfolders beforehand, but my main concern is getting the macro to automatically run through and make the 8 separate videos without manual input throughout.
Any help would be GREATLY appreciated!!
Cheers!