Created
May 22, 2023 08:24
-
-
Save pabloasanchez/3a29b25a91d7158e2f0ec2119d977d53 to your computer and use it in GitHub Desktop.
GIMP Python plug-in template from gimpbook.com with additional notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# GIMP Python plug-in template. | |
# To run the plugin, place it in .config/GIMP/plug-ins/PLUG_DIR/PLUG_NAME.py | |
# Where PLUG_DIR and PLUG_NAME are the name of your script e.g. myscript/myscript.py | |
# Note for AppImage version replace GIMP with GIMP-AppImage | |
# make the script executable (chmod +x myscript.py) | |
from gimpfu import * | |
def do_stuff(img, layer, howmuch) : | |
gimp.progress_init("Doing stuff to " + layer.name + "...") | |
# Set up an undo group, so the operation will be undone in one step. | |
pdb.gimp_undo_push_group_start(img) | |
# Do stuff here. | |
pdb.gimp_invert(layer) | |
# Close the undo group. | |
pdb.gimp_undo_push_group_end(img) | |
register( | |
"python_fu_do_stuff", | |
"Do stuff", | |
"Longer description of doing stuff", | |
"Your Name", | |
"Your Name", | |
"2010", | |
"Do Stuff...", | |
"*", # Alternately use RGB, RGB*, GRAY*, INDEXED etc. | |
[ | |
(PF_INT, "howmuch", "How much stuff?", 50) | |
], | |
[], | |
do_stuff, menu="<Image>/Filters/Enhance") | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment