3

I am using Gimp 2.8.14 on Win7. I have this large layered image, about 100 layers and I need a way to find out their offset to the canvas. If anyone know a way i would appreciate to know about it. I rather not do this manually with the mouse :)

4
  • Can you give more information?
    – yass
    Commented Apr 3, 2017 at 8:38
  • The layers are not as big as the canvas so they have an x and y offset and I need to know them. I mean I can select a layer and then try to see its coordinates by moving the mouse cursor but it is going to be very tedious. I am looking for something like: right click layer -> select show position/offset etc but I can not find that anywhere. Commented Apr 3, 2017 at 8:57
  • When I googled my problem I saw mentioned "layer.offset" but that was in a python script. But I do not have Python installed and have never used it with Gimp before. Commented Apr 3, 2017 at 9:00
  • Layer → Layer Boundary Size.X Offset; Y Offset These coordinates are relative to the layer, not to the image. They are used to move a frame that determines which part of the layer content will be selected for the resized layer
    – yass
    Commented Apr 3, 2017 at 10:54

1 Answer 1

6

This assumes that you have one single image loaded in Gimp.

  • Open Python-fu console (Filters>Python-fu>Console)
  • Enter the two lines:

    image=gimp.image_list()[0]
    for l in image.layers:print l.name,l.offsets
    
  • Strike [enter] twice
  • Copy/paste the result

If you want the layers in the opposite order, use

for l in reversed(image.layers):print l.name,l.offsets

If you have groups:

def dumpGroup(g):
    for l in g.layers:
        if isinstance(l,gimp.GroupLayer):
            dumpGroup(l)
        else:
            print l.name,l.offsets

image=gimp.image_list()[0]
dumpGroup(image)
3
  • Ahh great a built in python console :) I should get this to work now, only problem is that the code in your example did not list the children layers just the root or topmost layers. (the image is built with 5 root nodes who each got numerous children layers) Commented Apr 3, 2017 at 11:02
  • Also doable, but not with a one-liner. You would have to define a function, and call it recursively... Will check during lunch break.
    – xenoid
    Commented Apr 3, 2017 at 11:07
  • Added to answer...
    – xenoid
    Commented Apr 3, 2017 at 11:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .