SHARE
TWEET

Untitled

a guest Jul 25th, 2015 480 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env python
  2.  
  3. # GIMP Python plug-in template.
  4.  
  5. from gimpfu import *
  6.  
  7. def rename_layers(image, regex):
  8.     gimp.progress_init("Renaming layers")
  9.  
  10.     # Set up an undo group, so the operation will be undone in one step.
  11.     pdb.gimp_undo_push_group_start(image)
  12.  
  13.     # Image layers are reversed to start at the bottom.
  14.     i = 1
  15.     for l in reversed(image.layers):
  16.         l.name = (regex) % i
  17.         i += 1
  18.  
  19.     # Close the undo group.
  20.     pdb.gimp_undo_push_group_end(image)
  21.  
  22. register(
  23.     "python_fu_rename_layers",
  24.     "Rename Layers",
  25.     "Rename all layers with one template",
  26.     "MediocreGimp",
  27.     "MediocreGimp",
  28.     "2015",
  29.     "_Rename Layers (Py)...",
  30.     "*",      # Alternately use RGB, RGB*, GRAY*, INDEXED etc.
  31.     [
  32.         (PF_IMAGE, "image", "Input image", None),
  33.         (PF_STRING, "regex", "Pattern", "Frame %03d (41ms)(combine)"),
  34.     ],
  35.     [],
  36.     rename_layers, menu="<Image>/Image")
  37.  
  38. main()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top