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 want to export all layers using the image size, not the layer size.

Uncheck or remove the Use 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.

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

Add the Remove folder structure procedure (Add Procedure... → Remove folder structure).

How do I rename the layers 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.

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.

I want to adjust brightness in my layers. Can this be done?

Yes! You may insert any GIMP filter as a procedure:

  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.

I need every layer to have the same background.

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

I want to save the entire image as 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 group layer (instead of the entire image).

  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 For the entire image at once.
  3. If you selected For the entire image at once, adjust Image filename pattern as seen fit.
  4. You may want to uncheck the Use 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.

Export Options

Adjusting Layer Names (Filenames)

There are several built-in fields that you can combine to form a name pattern. For example, image[001] renames the 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 preview automatically updates as you change the name pattern and so can greatly help you figure out how your specified pattern affects the 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 layer. The numbering is separate for each group layer.

Options:

Examples:

[layer name]

The layer name.

Options:

Examples:

Full layer name

Equivalent to [layer name, %e].

[image name]

The current image name.

Options:

Examples:

[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:

[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 a layer 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]

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]

Layer or image attributes.

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 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

Export/Also export as…

Exports a layer to the specified file format.

For Export Layers, this performs export to another file format. This way, you can set up export to multiple file formats at once.

Options:

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

For 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 layer 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

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 layers tagged with a specific color tag as background for each layer.

The blue color tag is used as background by default. You may set a different color tag representing the background layers by adjusting the Color tag option.

This procedure is inserted at the first position. This prevents potential confusion when Use layer size is unchecked 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 Use 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.

By default, background layers themselves are excluded from editing/export as the Not background constraint is automatically added.

Insert foreground

Inserts layers tagged with a specific color tag as foreground for each layer.

The green color tag is used as foreground by default.

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) with the current layer.

When exporting layers, 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 an already inserted foreground layer (via Insert foreground, see above) with the current layer.

For more information, see Merge background above.

Remove folder structure

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

Options:

Rename

Renames layers according to the specified pattern.

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

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

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

Scale

Scales layers.

This is similar to the built-in Scale layer... procedure in GIMP that allows scaling width and height individually, using absolute (pixels) or relative (percentages) measures.

Options:

Use layer size (Export Layers only)

If enabled, layers will be resized (not scaled) to their size instead of the image size. This procedure is enabled by default.

To keep the size of the image canvas and the layer position within the image, disable this setting. Note that in that case the layers will be cut off if they are partially outside the image canvas. To export the entire layer, leave this setting enabled.

Adding Custom Procedures

You can add any built-in GIMP procedure or plug-in by pressing Add Procedure... and then selecting Add Custom Procedure....

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.

Constraints

To exclude certain 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

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

Group layers

Processes only group layers.

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

Not background (only available if Insert background is added)

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

Not foreground (only available if Insert foreground is added)

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

Matching file extension

Processes only layers having a file extension matching the extension typed in the text entry.

Selected in GIMP

Processes only layers selected in GIMP.

Selected in preview

Processes only layers selected in the preview.

If you save settings, the selection is saved as well.

Top-level

Processes only layers at the top of the layer tree (i.e. layers inside any group layer are excluded).

Visible

Processes only visible layers.

With color tags

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

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:

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 or manipulates the file system (reads or saves files).

Also apply to parent folders (constraints only)

If checked, a layer will satisfy a constraint if all of its parent groups 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-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-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 plug-in-batch-export-layers-quick and plug-in-batch-edit-layers-quick procedures perform export/editing with always the last used settings.