Batch Process

The Batch Process tool is used to record commands drawn from the MaxIm DL application menu into sequences, sometimes called "macros", and to edit them and play them back. For interactive commands, that is, those which invoke a modal dialog box to obtain control parameters, the complete set of values as they were at the time the command was recorded are all saved in the sequence. The same command can be used more than once in a single sequence, each time with different control parameters. Alternatively, command(s) can be marked as requiring user interaction; on playback, the sequence will open the command's dialog with the various controls preset to the recorded values, but will then pause and allow you to change settings. You can preview the operation as necessary in the usual way and even cancel the command dialog, but the remainder of the sequence will continue normally.

Batch sequences are perhaps most useful when you need to perform the same processing operations on a set of similar images. You record the sequence once by working through the processing steps on a single image, then play it back to process the others, either individually or in one or more groups. You can save sequences to disk for later use.

The principal advantages of sequences as compared to scripting is in ease of creation: no programming knowledge is required, and it is quick to set up a sequence for an ad hoc job. In addition, the sequence mechanism readily allows operator intervention for fine tuning the processing. Its main disadvantages are that it is slower to execute than a script and it is also less flexible because it provides no conditional structures such as ifs and loops. In addition, it can be difficult to ensure that MaxIm DL's focus goes to the desired document during window switching (F6, Alt+F6), creation (e.g. New and Duplicate), and deletion (Close). Although these operations can be recorded, care is advised.

When using sequences, remember that each command is still treated individually by MaxIm DL. In particular, you cannot Undo the effect of the whole sequence, only the last command executed. For this reason, you should consider saving images before you process them with a sequence, and avoid recording Save and Save All operations in a sequence; this will permit you to get back to the original image if necessary. Save As is safer because it always pauses to allow you to specify the destination filename, but you are then responsible for avoiding overwriting valuable data.

Also note that you should not include Open or Save commands in sequences that are intended to be applied to files on disk (described below). MaxIm DL automatically opens each such file when ready to process it, and saves and closes it after the last step of the sequence.

When first opened, the Batch Process window appears in the compact form shown at above left. The Operation list is initially empty. Above the Operation list is a small toolbar used to delete or change the order of steps in the active sequence, and below it a status message area and buttons to control recording, playback, sequence management, and toggle the window to the expanded form shown on the right. Controls in this section are described below.

To start recording a sequence, click the Record button . The red circle "lights up" to a brighter color and the status line changes from "Idle" to "Recording". Now perform the desired commands. Only commands shown in the MaxIm DL application menu can be recorded; operations initiated using buttons on the Camera Control or other modeless tool windows named in the View menu are not. As each command is completed, its name is added to the end of the Operations list. (Commands are not added if you Cancel out of the command dialog.) To the right of the new command in the list, the Manual checkbox indicates the disposition of this command during playback; when checked, playback will pause to allow you to modify the command's settings. Some commands never interact with the user, or alternatively always require user intervention; for these, the checkbox is gray and the disposition cannot be changed. A few commands simply cannot be recorded; you are warned about this and asked if you want to execute the command anyway.

If you record an incorrect command by mistake, select it in the Operations list and click the Delete button. This will not reverse any effect it had on the image, so you may need to Undo it as well; if so, don't forget to delete the Undo entry from the list too. You can reposition a recorded command in the list by selecting it and then clicking the Move Up or Move Down buttons. Sequence editing can also be performed after recording has been stopped.

Note that you cannot close the Batch Process window while recording is in progress.

When you have completed the sequence, either click Record a second time, or click Stop . You can resume recording at any later time by clicking Record again; this does not erase previously recorded commands.

To play back a sequence on a single image, select that image by clicking on it or its tab (if shown), then click on the Play button. The status line displays the name of the image being processed and playback starts at the first command in the sequence and normally proceeds automatically to the end. During playback, the command currently being executed is highlighted in the Operations list. When a Manual command is encountered, playback pauses with that command's dialog open and waits to allow you to modify the command settings, then resumes when you click OK. If you Cancel a command or if any other error occurs during processing, the sequencer displays a message asking if it should continue to execute the rest of the sequence; click Yes to continue, or No to abandon the sequence. You can also abort sequence playback by clicking the Stop button; it is not possible to resume a sequence from the point of interruption. (You could of course modify the sequence by deleting the commands already processed.) Note that a few commands behave slightly differently when sequenced than when performed manually; for example, Crop ignores any drag rectangle present in the image in favor of the recorded rectangle position and dimensions.

To play back a sequence on a group of files and/or open images, expand the Batch Process window by clicking the >> button. If you want to process files from disk, click Files... to display a selector dialog in which you navigate to and select the desired files; they are added to the Process Queue when you click OK. (Recall that each file will be automatically opened turn when the sequence runs, and do not add Open or Save commands yourself.) You can repeat the process to queue additional files, perhaps from different folders, but you cannot add any particular file more than once. If you want to process images that are already open, click the Images… button and select the desired image(s) from the pop-up Select Images dialog. This is a multiple-selection listbox; click to select a single image, Control-click to select additional images or deselect images already selected, and Shift-click to select the range extending from the previous single- or control-click. To select the entire list, click once on the first entry, scroll to the bottom if necessary, and then shift-click on the last entry.

You can distinguish files from images in the Process Queue by the presence of the folder path on the former or the "[Image]" tag that appears before the latter, depending on whether Show path is checked. To remove entries from the queue, simply select them and click Remove.

When Files are to be processed, select the Disposition option that describes how you want the result file to be saved. You can specify Rename original or Rename result to give the original or the result file a new name, Save result in to write the result to a subfolder of the directory from which it was loaded, or Overwrite original to replace the original. Be sure you have backups of your images when using this last option!

When renaming is specified, the new name is created by inserting the string specified by Add Suffix into the filename immediately before the file extension. For example, C:\Images\M13.fit could be renamed to C:\Images\M13-orig.fit by Rename original, or the resulting image saved as C:\Images\M13-new.fit by Rename result. The suffix replaces the existing extension altogether if it includes a period. If you choose to save the result to a Subfolder, specify it by name in the edit box. A subfolder is created automatically, when required, beneath each different directory which contains files to be processed. Renaming and saving occur only when the end of the sequence is reached, immediately before the processed image is saved. If the image cannot be saved or the original cannot be renamed, including the case where a file by that name already exists, a pop-up alert allows you to abort or continue the sequence. The unsaved result image is left open and can be saved manually. Note that none of this applies to Images added to the Process Queue; these are saved only if the sequence explicitly includes commands to do so, and automatic renaming or saving never occurs for them.

After selecting the Images and/or Files to be processed, press the Play Multiple button. Each entry in the queue is operated on in turn, beginning with the first. If an entry is a file, it is automatically loaded into a new window; if it is an image, its window is brought to the front. The entire sequence is performed on it, then it is saved and closed (if a file) and its entry in the Process Queue is greyed and struck out to mark it as processed. Then the next entry is processed in the same way. During multiple-image sequence playback the status line shows the number of the image within the queue and the total number of images being processed as well as the name of the current image.

If any struck-out entries exist in the Process Queue when entries are added or removed or Play Multiple is pressed, the sequencer asks if they should be removed or reenabled for processing. When reprocessing files, make sure you know their state: original or already-processed-once. It is also advisable to change the suffix each time, particularly when Renaming is set to Original.

To erase a sequence, click Clear. Typically you use this before recording a new sequence.

To save a sequence to disk for future use, click Save..., enter a filename in the Select dialog and click OK. Similarly, to load a batch from disk, click Load... and pick the desired file. The file selector remembers the last directory you used for batch files, but you can navigate to another if desired.