ofn-layer-tiles

This script is used to split a layer into individual tile layers (rectangles all of same height and width), or to position/join layers of same width and height to form a single continuous image.

Splitting

Splitting can be specified either as a number of columns and rows or as the width and height of the individual tiles.

The script is called via the menu entries:

Parameters

Tile name pattern

The tile name pattern specifies how the tile layers are named using specific tile data. In the pattern, names in braces are replaced by the values of these data for the tile. For instance, a pattern of Tile-{column1}-{row1}.png will produce the name Tile-2-3.png for the 2nd tile on the 3rd row.

The names of some numeric values have two forms: one ending in 0 and one ending in 1. The one ending in 0 starts at 0 (as computers count), while the one in 1 starts at 1 (as humans count).

The available values are:

Hints:

The name pattern is actually directly used as a Python format specification, so modifiers can be used. The most useful modifier for numbers is the ability to define a minimal length with zero-padding. This is done by adding :0Nd to the variable name in the braces, for instance {row1:03d} will insert the row number on at least three digits, with zeroes added to the left if necessary: 001, 013, 099, 100.

Joining

This script is called via the menu entry: Layer > Tiles > Join tiles

The script works on the selected layers, which means it is disabled in the menus if there aren’t at least two layers selected. You can select all layers by using Ctrl-A in the Layers list.

The script will not accept groups, but will accept their contents.

The final result replaces the bottom-most layer (and so has the same parent as this layer)

Parameters

Guessing the rows and columns

If the files are named so that they contain at least two identifiable groups of digits, then the last two groups are considered to be rows and columns numbers, and the numbers of rows and columns are determined by the difference between the smallest and biggest values. The following naming schemes are for instance valid:

Of course, the determination of which group of digits is the row and which is the column is under the control of the Rows/Columns order parameter.