Customization

Getting Started with Customization

Beyond the basic features, Batcher allows you to:

As the amount of customization may be overwhelming at first, you may want to take a look at a few examples below.

Examples

I don’t want to preserve folder hierarchy when exporting.

Add and check the Remove folder structure procedure if not already (Add Procedure... → Remove folder structure).

How do I rename the images to form a sequence of numbers, e.g. “image001”, “image002”, …?

Click on the text entry next to Name and choose image001, or type image[001] in the entry.

I want to adjust brightness in the images. Can this be done?

Yes! You may apply any GIMP filter or plug-in:

  1. Select Add Procedure... → Add Custom Procedure...
  2. Find gimp-drawable-brightness-contrast in the procedure browser.
  3. Adjust the options as desired.
  4. Select Add to add the procedure.

How can I insert watermarks?

You can think of watermarks as foreground, i.e. a layer added on top of your images.

For Batch Convert:

  1. Add the Insert foreground procedure and specify an image file serving as the foreground.
  2. (optional) You can adjust how the foreground is merged by setting the merge type in the Merge foreground procedure that was added automatically.

For Export Layers and Edit Layers:

  1. In GIMP, assign a color tag to the layer(s) you want to consider foreground (right-click on a layer → Color Tags → choose your color).
  2. Add the Insert foreground procedure and adjust the color tag as necessary.
  3. (optional) If you want the foreground to be offset to the current layer rather than the image canvas, place this procedure after Resize to layer size by dragging it onto Resize to layer size.
  4. (optional) You can adjust how the foreground is merged by setting the merge type in the Merge foreground procedure that was added automatically.

I need every image to have the same background.

You can follow the same steps as in the example above, except that you add the Insert background procedure (and adjust Merge background as needed).

I want to create a single multipage PDF file.

While multipage PDF export is already possible in GIMP without any third-party plug-ins, Batcher allows you to apply custom procedures before the export or export each folder/group layer as separate PDFs.

  1. Select or type pdf as the file extension.
  2. Press the Options... button and select an option in Perform export:. To export a single image, select As a single image.
  3. If you selected As a single image, adjust Image filename pattern as seen fit.
  4. For Export Layers, you may want to uncheck the Resize to layer size procedure to use the image size (since PDF pages have the same dimensions), otherwise you might obtain unexpected results.

I want to be able to export to multiple file formats at once.

You can achieve this by adding the Also export as... (or Export) procedure.

Each time you add this procedure, adjust the file extension, file format options and other settings as needed.

I want to export all layers using the image size, not the layer size.

Uncheck or remove the Resize to layer size procedure.

I want to export only visible layers.

Check the Visible constraint (or add one if not already via Add Constraint... → Visible).

I want to export only visible layers. However, I also want to exclude those that have invisible parent group layers.

  1. Check the Visible constraint (or add one if not already).
  2. Edit the Visible constraint (press the icon to the right of the constraint name). In the dialog, click on More options and then check Also apply to parent folders.

My layers contain a ‘.’. All characters after the ‘.’ are replaced with the file extension. How do I prevent this?

In the text entry next to Name, choose Full layer name or type [layer name, %e]. This ensures that the resulting image name will be e.g. some.layer.png instead of some.png (the default behavior).

How do I export only group layers at the top level?

  1. Uncheck the Layers constraint.
  2. Add the Group layers constraint.
  3. Add the Top-level constraint.

Export Options

Adjusting Filenames

There are several built-in fields that you can combine to form a name pattern. For example, image[001] renames the images/layers to image001, image002 and so on. The fields are described below in detail.

Press the Down button or click anywhere on the entry to display the list of available fields. The text entry can show you examples of how each field is used if you place the text cursor inside a field (e.g. inside [001]).

The input list of images/layers automatically updates as you change the name pattern and so can greatly help you figure out how your specified pattern affects the image/layer names.

You can combine multiple fields if needed, for example [layer name]-[001].

Fields must be enclosed in square brackets and must have a correct number of options. Options must be separated by commas. Invalid options result in the field being inserted literally.

Available fields

You can choose the fields from the dropdown list displayed when clicking on the text entry, or you can type the fields manually.

Number

A number incrementing for each image/layer. The numbering is separate for each folder/group layer.

Options:

Examples:

[image name]

The current image name.

Options:

Examples:

[image path] (Batch Convert only)

The “full path” of an image, from its topmost folder added as input to the image itself. This does not include folders above the folder added as input.

For example, if the folder named Body contains a subfolder named Hands which contains an image named Left, the image path will be Body-Hands-Left.

Options:

Examples:

[layer name] (Export Layers and Edit Layers only)

The layer name.

Options:

Examples:

Full layer name (Export Layers and Edit Layers only)

Equivalent to [layer name, %e].

[layer path]

The “full path” of a layer. For example, if the image has a group layer named Body containing a group layer named Hands containing a layer named Left, the layer path will be Body-Hands-Left.

Options:

Examples:

[output folder]

The output folder selected in the plug-in dialog.

Options:

Examples for a folder with the path C:\Users\username\Pictures:

[replace]

Replaces a part of the specified field with another string. This essentially allows to fine-tune any field. Regular expressions are supported as well.

Options:

For the example below, suppose that an image is named Animal copy #1. While the square brackets ([ and ]) enclosing the first three field options are optional, they are necessary in case you need to specify an empty string ([]), leading spaces or commas.

Examples:

[tags] (Export Layers and Edit Layers only)

Color tag assigned to a layer. For example, suppose that a layer has a green color tag assigned. Then (by default) the tag will be formatted as green.

Options:

Examples:

[current date]

The current date.

Options:

Examples:

[attributes]

Attributes of the current image and the current Layer.

Options:

Examples:

Inserting reserved characters in options

To insert a literal space or comma in a field option, enclose the option with square brackets. To insert a literal square bracket ([ or ]), double the bracket and enclose the option with square brackets (e.g. [[[] to insert a literal [).

If the last option is enclosed in square brackets, leave a single space between the last and the second to last closing square bracket.

Examples:

Procedures

Procedures allow you to apply image filters to each image/layer. Press the Add Procedure... button and select one of the available procedures, or add a custom procedure.

For each procedure, you may:

You can add the same procedure multiple times.

Built-in Procedures

Align and offset

Aligns layer(s) with the current image or, if specified, another layer within the image. You may specify additional offsets after the alignment is applied.

Options:

Export/Also export as…

Exports an image/layer to the specified file format.

For Batch Convert and Export Layers, this performs export to another file format.

You can add this procedure multiple times to export to multiple file formats at once.

Options:

The name of the Export procedure is automatically updated as you modify the file extension.

For Batch Convert and Export Layers, when this procedure is added, the values of the options are copied from the default export options. For example, the output folder will be identical to the one currently selected in the main dialog. This simplifies setting up export to multiple file formats without the hassle of manually adjusting the export options in all added procedures.

When exporting each image separately (the default, which can be changed via the Perform export option), the Export procedure usually makes sense to be applied as the last procedure since procedures after Export would have no effect on the current layer being processed.

Apply opacity from group layers (Export Layers and Edit Layers only)

Combines opacity from all parent group layers for each layer. This corresponds to how the layer is actually displayed in GIMP.

For example, if a layer has 50% opacity and its parent group also has 50% opacity, the resulting opacity of the layer will be 25%.

Insert background

Inserts a new layer behind the current layer.

For Batch Convert, specify an image file to be loaded as background.

For Export Layers and Edit Layers, mark layers in your opened image with a color tag. The blue color tag is used for background by default. You may set a different color tag by adjusting the Color tag option.

This procedure is inserted at the first position. This prevents potential confusion when Resize to layer size is not present and the background is offset relative to the layer rather than the image canvas. If this is your intention, you can always move this procedure below Resize to layer size.

The background is merged automatically at the end of processing as the Merge background procedure is automatically added. See Merge background below for more information.

For Export Layers and Edit Layers, the background layers are excluded from processing by default as the Not background constraint is automatically added and enabled.

Insert foreground

Inserts a new layer in front of the current layer.

For Export Layers and Edit Layers, the green color tag is used as foreground by default.

The Merge foreground procedure is added automatically. For Export Layers and Edit Layers, the Not foreground constraint is added automatically.

For more information, see Insert background above.

Merge background (only available if Insert background is added)

Merges already inserted background (via Insert background, see above) into the current layer.

When exporting, the background is merged automatically. However, if needed, you can reorder this procedure to perform the merge earlier and then apply procedures on the current layer, now merged with the background.

For Edit Layers, this procedure ensures that you have a single merged layer rather than having the background as a separate layer. If this is not what you desire, you may uncheck this procedure.

If there is no background layer inserted, this procedure has no effect.

Options:

Merge foreground (only available if Insert foreground is added)

Merges already inserted foreground (via Insert foreground, see above) with the current layer.

For more information, see Merge background above.

Merge filters

Merges all visible filters (layer effects) in the specified layer.

Merge visible layers (Batch Convert only)

Merges all visible layers within the image into a single layer. Invisible layers are removed.

This is useful if the image contains multiple layers and you want to apply filters (layer effects) or other procedures on the entire image.

Remove folder structure

Exports all images to the output folder on the same level, i.e. subfolders are not created.

Options:

Rename

Renames images/layers according to the specified pattern.

This procedure uses the same text entry as the one in Batch Convert or Export Layers next to Name, described in Adjusting Layer Names (Filenames).

For Batch Convert and Export Layers, this procedure performs renaming on top of the entry next to Name.

Additionally, this procedure allows customizing whether to rename both images/layers and folders (by checking Rename folders/Rename group layers) or rename folders only (by checking Rename folders/Rename group layers and unchecking Rename images/Rename layers).

Scale

Scales the entire image or a layer, using absolute (pixels) or relative (percentages) measures.

Options:

Resize to layer size (Batch Convert and Export Layers only)

If enabled, the image canvas will be resized to fit the layers. For Export Layers, this means that the exported image will have the same dimensions as the layer to export.

This procedure is enabled by default for Export Layers.

To keep the image canvas intact (thus keeping the layer position within the image), uncheck this procedure. Note that in that case the layers will be cut off if they are partially outside the image canvas.

Adding Custom Procedures

You can add any GIMP plug-in, layer effect (filter, GEGL operation) or GIMP procedure by pressing Add Procedure... and then selecting Add Custom Procedure.... Both built-in and any third-party plug-ins and layer effects are supported.

Procedure browser dialog

You can preview how the selected procedure affects the resulting image (by pressing Preview) and adjust procedure options.

Once you are settled on the procedure, press Add to permanently add it to the list of procedures. You can edit the procedure anytime after adding it.

All layer effects (procedures under the Filters, Effects category) have the following common parameters:

Constraints

To exclude certain images/layers from processing and export, press the Add Constraint... button and select one of the available constraints. Just like procedures, you may enable/disable, reorder, edit or remove constraints.

Built-in Constraints

Layers (Export Layers and Edit Layers only)

Processes only layers (i.e. group layers are not processed).

Group layers (Export Layers and Edit Layers only)

Processes only group layers.

You need to disable the Layers constraint since having both enabled will result in no layer being processed.

Not background (Export Layers and Edit Layers only, and only available if Insert background is added)

Processes only layers that are not inserted as background via Insert background.

Not foreground (Export Layers and Edit Layers only, and only available if Insert foreground is added)

Processes only layers that are not inserted as foreground via Insert foreground.

Matching file extension

Processes only images/layers having the file extension typed in the main dialog.

Matching text…

Processes only images/layers matching the specified text.

You can adjust how to perform matching - whether the image/layer name should start with, contain or end with the specified text to match. For example, with the “Ends with text” option, you can match against an arbitrary file extension instead of the one typed in the main dialog (via the Matching file extension constraint).

Matching can be made case-insensitive by checking the Ignore case sensitivity option.

You can also specify a regular expression pattern as defined in the re module for Python. Errors in the regular expression pattern will result in no matches.

Recognized file format (Batch Convert only)

Processes only images whose original file extension is supported by GIMP.

If you use third-party file load plug-ins with their own file extension, uncheck this constraint so they can be processed.

Selected in GIMP (Export Layers and Edit Layers only)

Processes only layers selected in GIMP.

Top-level

Processes only top-level images/layers (i.e. images/layers inside any folder/group layer are excluded).

Visible (Export Layers and Edit Layers only)

Processes only visible layers.

With color tags (Export Layers and Edit Layers only)

Processes only layers having a color tag.

By default, all layers without a color tag are excluded. To process only layers with specific color tags, edit this constraint and add the color tags for the Color tags option. For example, by adding a blue tag, only layers containing the blue tag will be processed. Other tagged or untagged layers will be excluded.

Without color tags (Export Layers and Edit Layers only)

Processes only layers without a color tag.

By default, all layers with a color tag are excluded. To exclude only specific color tags, edit this constraint and add the color tags for the Color tags option. For example, by adding a blue tag, all layers except the ones containing the blue tag will be processed.

If a group layer has a color tag, it will normally not be excluded. To also exclude group layers with color tags, click on More options and check Also apply to parent folders.

Editing Procedures and Constraints

To edit a procedure or a constraint, press the icon to the right of the procedure/constraint name and adjust the options in the displayed dialog.

The dialog will be automatically displayed for most built-in procedures when added.

If a procedure contains a layer/drawable/item option, you may select one of the following:

If a procedure contains an image option, there is only one option available - Current Image, representing the currently processed image.

More Options

Expanding More options allows you to adjust the options below.

Enable for previews

If checked (the default), the procedure/constraint is applied in the preview. Unchecking this can be useful if a procedure takes too long.

Also apply to parent folders (constraints only)

If checked, an image/layer will satisfy a constraint if all of its parent folders/group layers also satisfy the constraint. For example, if this option is checked for the Visible constraint, a visible layer is excluded if any of its parent group layers are not visible.

Running Batcher Without Dialog

It is also possible to run Batcher without an interactive dialog, e.g. for automation purposes.

The plug-in-batch-convert procedure allows running Batch Convert non-interactively, using the supplied UTF-8-encoded file (the inputs parameter) containing files and folders on each line, plus other export parameters such as the output folder or file extension. If run-mode is Gimp.RunMode.WITH_LAST_VALS, all these parameters (including inputs) will be ignored and instead the settings last used interactively (in the main dialog) will be considered.

The plug-in-batch-export-layers procedure exports layers with the specified or the last used settings, depending on the value of the run-mode parameter. Likewise, plug-in-batch-edit-layers runs batch editing layers with the specified/last used settings.

You can also run plug-in-batch-convert, plug-in-batch-export-layers or plug-in-batch-edit-layers with settings imported from a file by specifying the settings-file parameter. In that case, the run-mode must be Gimp.RunMode.NONINTERACTIVE and all other procedure arguments will be ignored (since these arguments will be assigned values from the settings file). The exception is the inputs parameter for plug-in-batch-convert, which will always be considered and the saved input images in the settings file will be ignored.

The plug-in-batch-export-layers-quick and plug-in-batch-edit-layers-quick procedures perform layer export/editing with always the last used settings. The plug-in-batch-export-selected-layers and plug-in-batch-edit-selecetged-layers procedures perform export/editing of selected layers with always the last used settings.