RSS/Atom feed Twitter
Site is read-only, email is disabled

Python-fu : how to remove layers ?

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

2 of 2 messages available
Toggle history

Please log in to manage your subscriptions.

Python-fu : how to remove layers ? chaouche yacine 31 Dec 11:54
  Python-fu : how to remove layers ? Ofnuts 31 Dec 14:52
chaouche yacine
2012-12-31 11:54:25 UTC (over 12 years ago)

Python-fu : how to remove layers ?

Hello. I have a gif animation that has 190 layers. It's a too much. I want to remove one out of three layers via the python-fu console. Here's what I did :

image = gimp.image_list()[0]
image.layers = [layer for (index,layer) in enumerate(image.layers) if index % 3]

Traceback (most recent call last): File "", line 1, in
AttributeError: attribute 'layers' of 'gimp.Image' objects is not writable

What is the correct way of removing layers ?

Thanks for you help in advance.

Ofnuts
2012-12-31 14:52:22 UTC (over 12 years ago)

Python-fu : how to remove layers ?

On 12/31/2012 12:54 PM, chaouche yacine wrote:

Hello. I have a gif animation that has 190 layers. It's a too much. I want to remove one out of three layers via the python-fu console. Here's what I did :

image = gimp.image_list()[0]
image.layers = [layer for (index,layer) in enumerate(image.layers) if index % 3]

Traceback (most recent call last): File "", line 1, in
AttributeError: attribute 'layers' of 'gimp.Image' objects is not writable What is the correct way of removing layers ?

for (index,layer) in enumerate(image.layers): ... if not index%3:
... image.remove_layer(layer)