You are here

CloneLayer Tool - GIMP 2.7.x - Updated!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
Rate this item!

Hello all!

I'm web-developer. I use the Gimp for making a web2-widgets or for small parts of design.
Usually, my work requires frequent duplication of layers and their exact placement on the canvas. However, the Gimp does not have a tool to perform batch processing of images (layers). So, I decided to write a small plugin that solves this problem. And I did it! I hope it will useful for you....
But the way, it is my first C plugin for GIMP under GTK framework. So be tolerant to me :)

About plugin:
"CloneLayer Tool" is a C plugin for Gimp 2.7 to automatically duplicate layers and apply to them some transformation and visual effects like - rotate, scale, move, blur and others....
This plugin works like batch processor which helps to make a set of clone layers with transformation on each of them.
Plugin shows the all change in "live mode" - on the gimp canvas (just set needed values and click on the "Clone"). So you can preview results before apply any changes.

Some Examples:

Video Tutorials:
1. "The Gears" -
Part#1 -
Part#2 -
Part#3 -

CloneLayer Tool can be used in following cases:
- to create an intricate pattern from simple geometric shapes. For example, you can create a star from simple curve, or a flower from an oval, or a snowflake from rectangle, etc. ...

- to create multiple copies of image (layer) and place them at a certain distance from each other.

- to create a composite image with a precise geometric arrangement of each of its parts. For example, a gear, a clock face, etc. ...

Once the plugin is installed successfully, the plugin can be found in The GIMP
using the menu "Layer->Clone-Layer Tool...".
It works for full image on the current layer. The selected region is ignored. (It will fixed in further)

The plugin dialog allows to adjust many parameters which sorted by groups:

The General Parameters:

Clone Times - how many clones must be created - from 1 to 1000;

Interpolation - uses for transformation (rotate, resize);

Add clone layers as -
- One layer - it will merge all clones to one layer;
- Grouping clone layers;
- Each clone to layer;

Autocroping layer -
if checked - remove empty borders from the layer;
else - resize layer to image size;

Orders -
- UP - add new clone above previous layer ;
- DOWN - add new clone under previous layer;

Resize (scale) group:
- provides some values to set a fixed and random step to increase/decrease width or height of layer.
Keep aspect - enabled a proportional scaling.
Resize Type - sets direction of resize - to Top/Left corner, etc....

Rotation group:
- provides parameters to set a fixed and random angle to rotate layer on each clone.
Coordinates -
Rotate Center X and Center Y - a rotate points
Get Coordinates - to set Center X and Center Y point by corners - Top/Right; Buttom/Left, ect ...

Move group:
- provides parameters to set a fixed and random step to increase/decrease distance between layers on each clone;
Move Layer From - selects corners between two layers to set a distance for them.

Effects group:
- has a few visual filters (effects) that could be added to layers. There are opacity and blur filters at the moment.
Opacity - you can set fixed or random step to increase/decrease transparency.
Blur - the same, but for the blur.
(new!) Colorize - you can change image hue by fixed or random step.
(new!) Noise Spread - the same like blur, but for the noise spread.
(new!) Drop Shadow - adding shadow under image.
(Note, the shadow area don't calculate on Move-steps!)

(new!) Animate group:
- this feature provide a simple way to manage the GIMP animate layers,
such as mode animation layer and speed layer.
On/Off - enable/disable animation setting.
Animation setting for First/Next and Last layer -
Mode layer - [combine|replace|none]
Speed - speed in ms/ from 0 to 10000.

...each setting will been added to end of layer name.
for ex.: layer_name-clt #1(300ms)(replace)

"CloneLayer Tool" is under development yet! And some features are incomplete!
Please, save your work before apply this plugin, or make duplicate image!
(The plugin doesn't provide undo step! So, for this reason a result of work will added at new layer and original layer will saved too. )

Sorry for my English! But, I hope you understand what I wrote above ;)
If not - sorry again ((

INSTALL from source
For Linux and Unix users
For a system wide installation simply state:

$gimptool-2.0 --install clone-layer-tool.c

A restart of The GIMP is recommended.

For Window users
C:\gimptool-2.0 --install-admin c:\pach_to_plugin_src\clone-layer-tool.c

!!! Note !!!
1. If your GIMP was installed to \Program Files\, you must reinstall it into
folder which non contains a blank space in the name!
i.e.: c:\gimp\ or d:\gimp_2.7\, ...

2. gimptool-2.0 required GTK+ libs and installed MiniGW!
Please install all needed soft and libs on your machine before compile plugin
using gimptool-2.0.

INSTALL from binary
copy Linux binary or Windows executable file to system or user plug-in folder:
for *nux - ~/gimp-2.7/plug-ins
for win* - C:\Documents and Settings\user_name\.gimp-2.7\plug-ins

Archive name - type:
gimp-clt-v0.2b-src.tar - source files to compile using gimptool-2.0. All platforms!
gimp-clt-v0.2b-bin.tar - Linux binary file - Windows executable file - win64 executable file
(thanks to samj - )

GIMP Version: 
Code License: 


This is a really useful script - it saved me so much time!
If only I had known about this before....

Compilation completed with full success, Xubuntu 12.10 32bit.
In the files / usr/include/gimp-2.0/libgimp /gimpdrawable.h & gimplayer_pdb.h at compile time I deleted three lines of code
#if !defined (__GIMP_H_INSIDE__) && !defined (GIMP_COMPILATION)
#error "Only can be included directly."
gimptool-2.0 --build clone-layer-tool.c
gcc -pthread -I/usr/include/gtk-2.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/cairo -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/lib/i386-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/gimp-2.0 -o clone-layer-tool clone-layer-tool.c -lgimpui-2.0 -lgimpwidgets-2.0 -lgimpmodule-2.0 -lgimp-2.0 -lgimpmath-2.0 -lgimpconfig-2.0 -lgimpcolor-2.0 -lgimpbase-2.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0
In file included from run.c:12:0,
from clone-layer-tool.c:16:
dialog.c: In function ‘clone_dialog’:
dialog.c:2444:21: warning: assignment from incompatible pointer type [enabled by default]

So here I share the binary for the "Clone Layer Tool" plugin, 64bit on GNU/Linux (extract and copy it to the GIMP plug-ins folder as usual):

Thanks! The workaround works for me.

You`re welcome.

I can not compile on Kubuntu 32-bit:
$ gimptool-2.0 --install clone-layer-tool.c
gcc -pthread -I/usr/local/include/gimp-2.0 -I/usr/local/include/gegl-0.2 -I/usr/local/include/babl-0.1 -I/usr/include/gtk-2.0 -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/cairo -I/usr/include/libpng12 -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/lib/i386-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -o /home/yafu/.gimp-2.9/plug-ins/clone-layer-tool clone-layer-tool.c -Wl,--export-dynamic -pthread -L/usr/local/lib -lgimpui-2.0 -lgimpwidgets-2.0 -lgimpmodule-2.0 -lgimp-2.0 -lgimpmath-2.0 -lgimpconfig-2.0 -lgimpcolor-2.0 -lgimpbase-2.0 -lgtk-x11-2.0 -lgegl-0.2 -lgmodule-2.0 -lrt -lbabl-0.1 -lm -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0
In file included from clone-layer-tool.h:20:0,
from clone-layer-tool.c:15:
/usr/local/include/gimp-2.0/libgimp/gimpdrawable.h:22:2: error: #error "Only can be included directly."
In file included from run.c:12:0,
from clone-layer-tool.c:16:
dialog.c: In function ‘clone_dialog’:
dialog.c:2444:21: warning: assignment from incompatible pointer type [enabled by default]
In file included from clone-layer-tool.c:16:0:
run.c: In function ‘run’:
run.c:46:3: warning: ‘gimp_drawable_get’ is deprecated (declared at /usr/local/include/gimp-2.0/libgimp/gimpdrawable.h:51): Use 'gimp_drawable_get_buffer' instead [-Wdeprecated-declarations]
run.c:126:3: warning: ‘gimp_drawable_flush’ is deprecated (declared at /usr/local/include/gimp-2.0/libgimp/gimpdrawable.h:55): Use 'gegl_buffer_flush' instead [-Wdeprecated-declarations]
run.c:127:3: warning: ‘gimp_drawable_detach’ is deprecated (declared at /usr/local/include/gimp-2.0/libgimp/gimpdrawable.h:53) [-Wdeprecated-declarations]
In file included from clone-layer-tool.c:17:0:
onExit.c: In function ‘onExit’:
onExit.c:33:2: warning: ‘gimp_drawable_flush’ is deprecated (declared at /usr/local/include/gimp-2.0/libgimp/gimpdrawable.h:55): Use 'gegl_buffer_flush' instead [-Wdeprecated-declarations]
onExit.c:34:2: warning: ‘gimp_drawable_detach’ is deprecated (declared at /usr/local/include/gimp-2.0/libgimp/gimpdrawable.h:53) [-Wdeprecated-declarations]
In file included from clone-layer-tool.c:20:0:
/usr/local/include/gimp-2.0/libgimp/gimplayer_pdb.h: At top level:
/usr/local/include/gimp-2.0/libgimp/gimplayer_pdb.h:24:2: error: #error "Only can be included directly."
clone-layer-tool.c: In function ‘cloneLayer’:
clone-layer-tool.c:253:4: warning: ‘gimp_image_get_layer_position’ is deprecated (declared at /usr/local/include/gimp-2.0/libgimp/gimpimage.h:52): Use 'gimp_image_get_item_position' instead [-Wdeprecated-declarations]
clone-layer-tool.c:255:4: warning: ‘gimp_image_get_layer_position’ is deprecated (declared at /usr/local/include/gimp-2.0/libgimp/gimpimage.h:52): Use 'gimp_image_get_item_position' instead [-Wdeprecated-declarations]
Thank you!

i get in Fedora 17 32 bit.


Works perfectly.


This plug-in is soooo cool.

I had an idea in my head but was afraid to try doing it manually, it would be too many steps. Then I tried this one and ... WOW!!! It did exactly what I was thinking. Its great, awesome, superb.

So good, in fact, that I registered here just to be able to comment and thank you and repeat how wonderful it is.

To see what I did with this plug-in, please visit:

P.S.: I am using Partha's portable GIMP 2.7.3 on Windows 7 - 64 bit. I downloaded samj's binary for v0.1 and it worked perfectly. Only now, reading this again, I realised there's v0.2.

P.P.S.: I used only the rotate option so far, because that's what I wanted. One thing I observed: when rotating, if the background is plain, it crops it, whether or not I had Autocrop clear or selected. I got around this by putting one dot in each corner of the image.

Hi! I added new video tut - "The Gears".
This tutorial how to draw a splashscreen like here:

Uploaded with
Watch, please -


Subscribe to Comments for "CloneLayer Tool - GIMP 2.7.x - Updated!"