Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
GIMP 2.10.32 Python-Fu
#1
I have successfully written a script, which when ran in the Python-Fu console does what I want. I want to make a keyboard shortcut, so I can run this quickly when necessary, rather than pasting it into the console every time. How should I do this? I've tried writing the code in VS code and saving it in the GIMP scripts folder as both a .py and .scm file. The .scm file raises 'unbound variable: import' when I hit 'refresh scripts' under Script-Fu. I cannot find where to run the script as a .py, but it seems to refresh fine. I also do not know how I would bind a keyboard shortcut to a script.

Here's the code, though I doubt this is the issue as it works fine in the console:

import gimpfu
current_image = gimp.image_list()[0]
layer=pdb.gimp_layer_new(current_image, 1, 1, gimpfu.RGB_IMAGE, "white_layer", 100, gimpfu.NORMAL_MODE)
pdb.gimp_image_add_layer(current_image, layer, 0)
pdb.gimp_layer_resize_to_image_size(layer)
pdb.gimp_item_set_visible(layer, 0)
Reply


Messages In This Thread
GIMP 2.10.32 Python-Fu - by alecpepe - 07-25-2022, 07:06 PM
RE: GIMP 2.10.32 Python-Fu - by Ofnuts - 07-25-2022, 10:52 PM

Forum Jump: