How do I access the bottom layer of an image.
I used to do something like this in GIMP 2.10.x:
layers = image.layers
bottom_layer = image.layers[len(layers) - 1]
What’s the equivalent in GIMP 2.99?
How do I access the bottom layer of an image.
I used to do something like this in GIMP 2.10.x:
layers = image.layers
bottom_layer = image.layers[len(layers) - 1]
What’s the equivalent in GIMP 2.99?
From file-openraster.py
:
layer_stack = image.list_layers()
# Number of top level layers for tracking progress
lay_cnt = len(layer_stack)
Thank you. That’s what I needed.
In Python you can use negative indexes to access the end of a list, so
bottom_layer = image.layers[len(layers) - 1]
is better written as:
bottom_layer = image.layers[-1]
Oh sure, yes.
Sometimes I’m thinking too complicated. Thanks for the tip.
This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.