Change layer name in GIMP, Python-Fu

Designing the awesome background of this blog, I was faced with the problem of having to modify the names of all 190 or so layers in a GIF, output by FX-Foundry's Hue Changer animation script.

(FX-Foundry, perhaps the largest script collection available for the GIMP, is available on Debian-based systems in the gimp-plugin-registry package.)

Fortunately, the automatic layer name changer didn't work (the latest official release is a bit dated), so in order to make a compelling animation, I had to rename all the layers by hand. Or did I?

It appears GIMP's Python-Fu is quite easy to grasp conveniently for such tasks. All it took me was a little research and the following short code pasted in the Python-Fu console:
image = gimp.image_list()[0]
for layer in image.layers:
    layer.name += ' (replace) (2000ms)'
And there, I have a 190-layer GIF animation changing face every 2 seconds. Yay! :-)

Proves once again the power and aptitude of open-source software.


  1. Super helpful. This is way less contrived than I thought it would be. Thanks for sharing.

    Now if only GIMP would allow reference-duplicated layers I could have some real fun.

  2. Thank you sir! I know this is old, but you just saved me many hours of renaming layers to speed up a gif :)

    If anyone's curious, here's the code: http://www.pasteall.org/54505/python

    It just separates the milliseconds from the layer name, divides it by 3 (to speed it up 300%), and adds it back into the layer name.