You are here

Multi-Replicate

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Rate this item!
AttachmentSize
multi-replicate.zip5.24 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.
Values can range from 1 to 64.
Autocrop duplicates
Checking this box will cause the layer copies to be automatically cropped before any transformation, by removing the borders that are fully transparent
Displacement in X direction / Displacement in Y direction
Sets the amount by which each duplicate will be horizontally/vertically shifted relative to the previous one before any scaling and rotation. This option also affects the first duplicate, that will be shifted by the same length relative to the original drawable.
Values can range from -4096 to 4096.
Unit of measure for displacements
% of duplicate extents: the horizontal/vertical displacement is expressed as a percentage of the width/height of the current duplicate, by referring to its autocropped version if the “Autocrop duplicates” checkbox is enabled.
% of scaled duplicate extents: the horizontal/vertical displacement is expressed as a percentage of the width/height that the current (and possibly autocropped) duplicate will take after being scaled and before being rotated.
% of image extents: the horizontal/vertical displacement is expressed as a percentage of the width/height of the current image.
Pixel: the displacements are expressed in pixels.
Final scale factor in X direction / Final scale factor in Y direction
Determines the scale factor by which to enlarge or reduce (before any rotation) the last duplicate with respect to the original layer in horizontal/vertical direction. When the number of copies is greater than two, the width/height of each duplicate will be increased or decreased, relative to the width/height of the preceding layer, by a constant length increment, until reaching the maximum or minimum horizontal/vertical dimension at the last layer copy.
Values vary within a range of 0.25 to 4.
Begin scaling from
Allows you to choose whether to start scaling the layer copies as from the first duplicated (inclusive) or as from the second duplicate (inclusive, if any).
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
Specifies the horizontal/vertical coordinate of the center around which the layer copies will rotate, as the horizontal/vertical distance from the origin selected in the “Origin of coordinates” option.
Values vary within a range of -262144 to 262144.
Unit of measure for coordinates
% of duplicate extents: the horizontal/vertical coordinate of the rotation center is expressed as a percentage of the width/height of the current duplicate, by referring to its autocropped version if the “Autocrop duplicates” checkbox is enabled.
% of scaled duplicate extents: the horizontal/vertical coordinate of the rotation center is expressed as a percentage of the width/height taken by the current (and possibly autocropped) duplicate after being scaled.
% of image extents: the horizontal/vertical coordinate of the rotation center is expressed as a percentage of the width/height of the current image.
Pixel: the coordinates of the rotation center are expressed 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.
Displace 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.
Interpolation method
Lets you select the method of interpolation to use for transforming the layer copies.
The available methods are: Lanczos, Cubic, Linear, None.
Stack duplicates
Allows you to choose 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.
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_

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