Moving Multiple Layers in GIMP

I’m not talking about applying a transformation or anything; I want to select multiple layers and physically change their order in the layer list (or whatever it’s called). There doesn’t seem to be a way to select multiple layers in this manner.


How to move multiple layers on the stack

GIMP’s UI does not provide a way to reorder several items directly – but it can be done by issuing direct commands in one of the two scripting languages embedded in GIMP.

Under filters you can get both “Python” console and the “Script-fu” console. Unless you already know to program Scheme (script-fu) , I suggest you to use the Python console for that, as it is a far-more useful language both inside GIMP, as in scriptting other applications and general computing purposes.

So, let’s suppose you want to move all layers marked as “linked” (see the second half of the answer on how to link layers) to the top of the image.
The needed steps are:

  1. get a reference to the image
  2. For each layer on the image, from bottom to top:
    1. move it to the top

Hands on: open the Python console (Filters->Python->Console) and type in, after the >>> prompt:

img = gimp.image_list()[0]

(this gets a reference to the image open on the rightmost tab, and stores it in the variable named img)

for layer in reversed(image.layers):
    if layer.linked:
       pdb.gimp_image_reorder_item(img, layer, None, 0)

So, even without any programming experience, one should be able to read these three lines – the last line is a function call. To see other possible functions, just click on the Browse button at the bottom of the Python console. The 4 parameters passed mean the image, the layer, the layer parent (in case you want to insert it in a layer group – None is for the image), and the desired position, counting from the top.

(For frequent use, you can write these lines of code in a programming friendly text editor, and jsut paste the block – or you can search for some of my other answers where I lay the guidelines for building a full GIMP plug-in, where the code to be run becomes available as menu option)

How to trasnslate or transform multiple layers in GIMP

(Sorry – at first I miseread the question, and wrote the answer bellow on how to translate (move on the canvas) a layer selection. Since the text bellow might help someone searching for it and ending on this question, I will just leave it here)

GIMP has the concept of “linked” layers. You can only have one set of linked ayers at a time, and when it first came up, it was the poor substitute for layer groups.

All transforms or translations (i.e. layer moves) performed in one such linked layer results in all linked layers being moved along with the first one.

To mark a layer as “linked” just click on the left of the visibilty “eye” icon for a given layer on the Layers Dialog. Mark all the layers you want to move together this way, and move one of them.

Source : Link , Question Author : user83635 , Answer Author : jsbueno

Leave a Comment