Image saving in Openlab automations

Hello again! This month I want to talk about saving images in automations in Openlab.  Let’s say for instance that you want an automation to save after every x loops.  How do you design an automation to do this?

Let’s look at this with a simple timelapse automation, here’s one I made earlier.

So the automation starts with a ‘Start’ task. In the ‘Target image window’ task I have chosen to target a new image document and bring this to the top.

The ‘Multiple input’ task is set-up as in the dialog below.

This will prompt the user to enter;

The total number of images to be acquired

The delay between each image in seconds

A file name to be used when the image document is saved

And finally the number of images to be captured before saving

This will prompt the user to enter a number which will define after how many loops the automation will save. We will call this variable ‘save’.

The ‘loop’ task is putting the loop count into a variable called ‘count’

The delay task is the first task to be executed in the loop.  We use the variable ‘delay’ as this is the variable that was used to store the delay time in seconds in the ‘Multiple’ input’ task.

You will notice that I have used the option (since) ‘This task finished’.  This will give you a ‘delay’ in seconds from the time the task was last executed.  In the first loop there will be no delay as it would be the first time the task was executed. The next time the delay is encountered it will give you a delay from the time the task was last executed.

The ‘Capture Layer’ task can be set-up as you like, I have simply chosen to ‘Bring the new layer to the top’.

Now to the all important 'if' task:

If  count%save = 0

Before you ask, this does look like the percentage symbol, but to the Automator it means divide ‘count’ by ‘save’ and return the remainder.  The % is known as the Modulus Operator.

What this basically means is that if the remainder is zero the T/true link will be followed.

In other words if ‘save’ divides perfectly into the ‘count’ the T/true link will be followed and the image document will be saved.

I have set up the ‘save’ task as in the dialog below. In the way I have written this particular automation it is important that you set up the folder in the ‘save image document’ task.

Taking this a stage further you could choose to save then close the image document and open a new one. This might be particularly useful if you want to free up memory, handy if you are running a rather long timelapse with lots of images.

So as you can see I have added some extra tasks.

I have used the task ‘Close image window’ to close the image document (there is no set up dialog for this task).

Then I have used a ‘Target image window’ task to target a new image document and bring it to the top.

There is one other important change if you want to consider this approach. At present each image document produced by the automation is saved with the same file name, this name is defined by the variable ‘filename’ that is captured when the user fills in the ‘Multiple input’ at the start of the automation.

If each image document has the same file name then as each one is saved it will overwrite the previous one, but obviously this is not a good idea.

The best way to do this is to number each of the files and add this number to the filename so that each image document has a different name.

There is more than one way to achieve this but I think the neatest would be to use the automator variables we have created, namely ‘count’ and ‘save’ in an equation count/save in a variable task.

Its location in the automation, after the ‘if’ task containing the Modulus Operator means that the variable task would only be executed when the variable ‘save’ divides perfectly into ‘count’.

This would yield 1 on the first execution, 2 on the second etc.

Finally change the ‘save’ task so the file is saved with a name starting with the variable ‘file_number’.

If you want to pad the number with zeros so the files can be correctly sorted by name in the operating system use;


As opposed to


This approach will be good for up to 1000 files, if you plan to produce more files than this use a bigger number such as 10000.

Hope this helps you to save your images in automations.  See you next time!