Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # GIMP Python plug-in template.
- from gimpfu import *
- def rename_layers(image, regex):
- gimp.progress_init("Renaming layers")
- # Set up an undo group, so the operation will be undone in one step.
- pdb.gimp_undo_push_group_start(image)
- # Image layers are reversed to start at the bottom.
- i = 1
- for l in reversed(image.layers):
- l.name = (regex) % i
- i += 1
- # Close the undo group.
- pdb.gimp_undo_push_group_end(image)
- register(
- "python_fu_rename_layers",
- "Rename Layers",
- "Rename all layers with one template",
- "MediocreGimp",
- "MediocreGimp",
- "2015",
- "_Rename Layers (Py)...",
- "*", # Alternately use RGB, RGB*, GRAY*, INDEXED etc.
- [
- (PF_IMAGE, "image", "Input image", None),
- (PF_STRING, "regex", "Pattern", "Frame %03d (41ms)(combine)"),
- ],
- [],
- rename_layers, menu="<Image>/Image")
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement