Multi-Replicate

Overview

This script is a powerful tool designed to duplicate layers and channels in advanced mode.

Original image

"Multi-Replicate" applied

It basically generates multiple copies of the active drawable into the current image, giving the possibility of spacing them along the horizontal and vertical directions. Furthermore, if the original drawable is a layer, the copies can be consecutively scaled and rotated, as well as conveniently combined inside the image, by putting them in a new layer group or merging them together. When enabling all of the transformations provided by the script, they will be applied to each duplicate in the following order: autocropping, displacement, scaling, rotation. Lastly, when this script is called from within another script, it outputs a vector whose elements are the identifiers of the generated duplicates.

Activating the script

Once installed, you can launch this script from the image menubar through: "Edit -> Multi-Replicate...".

It is also possible to access the script through the Layer local pop-menu or the Channel context menu, by right-clicking on the thumbnail of the specified layer or channel inside the relevant dialog.

Options

Number of copies

Defines the number of duplicates to generate from the original drawable. Values can range from 1 to 512.

Autocrop layer copies

Checking this box will cause the layer copies to be automatically resized before any transformation, by removing the borders that are fully transparent.

Displacement in X direction, Displacement in Y direction

Set the amounts by which each duplicate will be horizontally and vertically displaced with respect to the previous one before any scaling and rotation. These options also affect the first duplicate, that will be shifted by the same amounts relative to the original drawable. Values can range from -4096 to 4096.

Unit of measure for displacements

Here you can choose how to express the displacements in X and Y directions.

  • % of duplicate extents: as a percentage, respectively, of the width and the height of the current duplicate, by referring to its autocropped version if the “Autocrop layer copies” checkbox is enabled.
  • % of scaled duplicate extents: as a percentage, respectively, of the width and the height that the current (and possibly autocropped) duplicate will take after being scaled and before being rotated.
  • % of image extents: as a percentage, respectively, of the width and the height of the current image.
  • Pixel: in pixels.

The following illustration refers to the duplication of a layer depicting an ice lolly, whose copies are scaled and vertically displaced relative to one another. It shows the difference, in terms of results, between the first and the second option of the drop-down list in question.

Original image

"Unit of measure for displacements" set to the first option

"Unit of measure for displacements" set to the second option

Final scale factor in X direction, Final scale factor in Y direction

Determine the scale factors by which to enlarge or reduce (before any rotation) the last duplicate relative to the original layer in horizontal and vertical direction respectively. When the number of copies is greater than two, the width and the height of each duplicate will be increased or decreased, relative to the respective ones of the preceding layer, by constant length increments, until reaching the maximum or minimum dimensions at the last layer copy. Values vary within a range of 0 to 4.

Starting angle of rotation (in degrees)

Specifies the angle through which the first duplicate will be rotated relative to the original layer. Values can range from -180 to 180, where positive values correspond to clockwise rotations and negative values correspond to counterclockwise rotations.

Incremental angle of rotation (in degrees)

Specifies the fixed angular increment through which each layer copy following the first one will be rotated relative to the previous duplicate. Values can range from -180 to 180, where positive values correspond to clockwise rotations and negative values correspond to counterclockwise rotations.

X coordinate of rotation center, Y coordinate of rotation center

Set the horizontal and vertical coordinates of the center around which the layer copies will rotate, namely the horizontal and vertical distances from the origin selected in the “Origin of coordinates” option. Values vary within a range of -262144 to 262144.

Unit of measure for coordinates

Here you can choose how to express the X and Y coordinates of the rotation center.

  • % of duplicate extents: as a percentage, respectively, of the width and the height of the current duplicate, by referring to its autocropped version if the “Autocrop layer copies” checkbox is enabled.
  • % of scaled duplicate extents: as a percentage, respectively, of the width and the height taken by the current (and possibly autocropped) duplicate after being scaled.
  • % of image extents: as a percentage, respectively, of the width and the height of the current image.
  • Pixel: in pixels.

Origin of coordinates

Lets you select the origin from which the coordinates of the rotation center of each layer copy are measured. The available origins are: Upper left corner of original layer, Upper left corner of image.

Shift rotation center with layer copies

When this box is checked, the rotation center will be shifted together with the layer copies, meaning that its horizontal and vertical coordinates will be progressively increased from time to time by the values specified, respectively, with the "Displacement in X direction" and "Displacement in Y direction" options. The example below illustrates how the effect of the duplication changes according to whether this option is enabled or not, in case of simultaneous rotation and displacement of the duplicates.

Original image

"Shift rotation center with layer copies " enabled

"Shift rotation center with layer copies " disabled

Step to start transforming from

Allows you to choose the stage of duplication from which the planned transformations (displacement, scaling, rotation) have to start, so as not to alter all the duplicates that precede the one generated at that step.

Interpolation method

Lets you select the method of interpolation to use for transforming the layer copies. The available methods are: None, Linear, Cubic, Lanczos.

Stack duplicates

Allows you to decide whether to arrange the copies from bottom to top (Above each other) or from top to bottom (Below each other) in either the Layer or Channel Stack, so that each duplicate will appear, respectively, in front of or behind the previous one, as shown in the illustration below.

Original image

"Stack duplicates" set to "Above each other"

"Stack duplicates" set to "Below each other"

Group layer copies

When this checkbox is activated, the layer copies will be put into a new layer group.

Merge layer copies together

When this checkbox is activated, the layer copies will be eventually merged into a single layer.