You are here

Multi-Replicate

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Rate this item!
AttachmentSize
multi-replicate.zip6.09 KB

Gino D's GIMP Scripts:
https://sites.google.com/site/ginodonig/gimp-scripts


Overview

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

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.

 
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.

 
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.

 
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.

Code License: 
GIMP Version: 
Scripting Engine: 

Comments

RELEASE NOTES

  • Fixed an issue occurring when the active drawable is a layer group, causing the script to crash instead of displaying the proper warning message about the inability to operate on layer groups.

RELEASE NOTES

  • Increased the maximum number of copies allowed from 64 to 512.
  • Decreased the minimum value allowed for the final scale factors from 0.25 to 0.00.
  • Added the ability to start transforming the duplicates relative to one another beginning from any step of duplication.
  • Renamed some settings in the dialog window and changed the default interpolation method to 'Cubic'.
  • Fixed some minor bugs; enhanced and cleaned up the code.

_RELEASE NOTES_

  • Renamed the script from "Drawable Multiplication" to "Multi-Replicate".
  • Made the script fully compatible with GIMP 2.8, while maintaining the backward compatibility with the previous versions beginning from GIMP 2.6.10.
  • Added the abilities to scale and rotate the duplicates, with the possibility of selecting the interpolation method.
  • Added the option to order the duplicates in the stack either from bottom to top or from top to bottom.
  • Added the option to place the duplicates of a layer into a new layer group.
  • Now the vector returned by the script contains only the identifiers of the generated duplicates without the one of the original drawable.
  • Optimized the method of duplication.
  • Lots of improvements, cleanups and minor bug fixes regarding both the code and the dialog window.

_RELEASE NOTES_

  • Now you can also access the script through the Layer local pop-menu and the Channel context menu, by right-clicking on the thumbnail of the specified layer or channel in the relevant dialog.
  • Fixed a small flaw in the display of the progress bar.
  • Corrected the year range in my copyright notice.
  • Other small improvements and some code cleanups were made.

_RELEASE NOTES_

  • Now it is possible to express the offsets even as a percentage with respect to the image extents.
  • Added the ability to merge the duplicates of a layer into a single layer.
  • Added the ability to autocrop the duplicates.
  • Improved the method of duplication.
  • Reshaped and cleaned up the code.

_ RELEASE NOTES _

* Now the script can offset the duplicates even when the original drawable is a channel.
* Forced the script to be inactive if there is a floating selection inside the image.
* Reshaped and cleaned up the code.

I love the script. It works great to create animations. I do have a question/idea/suggestion though. I do not know how to write scripts -- yet -- but was wondering if it is possible to set your script to follow a path? Instead of stroking to path with a brush, kind of stroking to path with the drawable multiplication script?

Sorry for answering late, I didn't notice your comment until now.

I think your idea is very interesting. As soon as I get time, I will try to implement the functionality you suggest.

Thank you again.

Works great for my perspective drawings. I'll be sure to find a multitude of other uses for this as well. :)

Good job!

I'm glad that you liked my script.

Subscribe to Comments for "Multi-Replicate"