 |
| New Member |
Joined: Mar 21, 2017 Posts: 4
|
gimp.imagelist() is exactly what I'm trying to use in the snippet above. I'm editing the plugin from a working exercise plugin, which operates on one image and works. The working code that works on one image: #!/usr/bin/env python
from gimpfu import *
def extreme_unsharp_desaturation(image, drawable, radius, amount, desaturate_mode): # Unsharp mask from filters menu pdb.gimp_image_undo_group_start(image) threshold = 0 pdb.plug_in_unsharp_mask(image, drawable, radius, amount, threshold) pdb.gimp_desaturate_full(drawable, desaturate_mode) pdb.gimp_image_undo_group_end(image)
register( "python-fu-extreme-unsharp-desaturation", "Unsharp mask and desaturate image", "Run an unsharp mask with amount set to 5, then desaturate image", "Jackson Bates", "Jackson Bates", "2015", "Extreme unsharp and desaturate...", "RGB", # type of image it works on (*, RGB, RGB*, RGBA, GRAY etc...) [ # basic parameters are: (UI_ELEMENT, "variable", "label", Default) (PF_IMAGE, "image", "takes current image", None), (PF_DRAWABLE, "drawable", "Input layer", None), (PF_SLIDER, "radius", "Radius", 5, (0, 500, 0.5)), (PF_SLIDER, "amount", "Amount", 5.0, (0,10,0.1)), (PF_RADIO, "desaturate_mode", "Set Desaturation Mode: ", DESATURATE_LIGHTNESS, ( ("Lightness", DESATURATE_LIGHTNESS), ("Luminosity", DESATURATE_LUMINOSITY), ("Average", DESATURATE_AVERAGE) ) ) ], [], extreme_unsharp_desaturation, menu="<Image>/Filters/Enhance") # second item is menu location
main()
The entire code that gets the error: #!/usr/bin/env python
from gimpfu import *
def extreme_unsharp_desaturation_multi(image, drawable, radius, amount, desaturate_mode): pdb.gimp_image_undo_group_start(image) num_images, image_ids = pdb.gimp_image_list() #function returns multiple values threshold = 0 for tempimage in pdb.gimp_image_list(): pdb.plug_in_unsharp_mask(tempimage, drawable, radius, amount, threshold) pdb.gimp_desaturate_full(tempimage.active_drawable, desaturate_mode) pdb.gimp_image_undo_group_end(image)
register( "python-fu-extreme-unsharp-desaturation-multi", "Unsharp mask and desaturate image", "Run an unsharp mask with amount set to 5, then desaturate image", "Jackson Bates", "Jackson Bates", "2015", "Extreme unsharp and desaturate multi...", "RGB", # type of image it works on (*, RGB, RGB*, RGBA, GRAY etc...) [ # basic parameters are: (UI_ELEMENT, "variable", "label", Default) (PF_IMAGE, "image", "takes current image", None), (PF_DRAWABLE, "drawable", "Input layer", None), (PF_SLIDER, "radius", "Radius", 5, (0, 500, 0.5)), (PF_SLIDER, "amount", "Amount", 5.0, (0,10,0.1)), (PF_RADIO, "desaturate_mode", "Set Desaturation Mode: ", DESATURATE_LIGHTNESS, ( ("Lightness", DESATURATE_LIGHTNESS), ("Luminosity", DESATURATE_LUMINOSITY), ("Average", DESATURATE_AVERAGE) ) ) ], [], extreme_unsharp_desaturation_multi, menu="<Image>/Filters/Enhance") # second item is menu location
main()
The contents of the other variables are populated by dialog or constants. And the error: Traceback (most recent call last): File "C:\Program Files\GIMP 2\32\lib\gimp\2.0\python\gimpfu.py", line 736, in response dialog.res = run_script(params) File "C:\Program Files\GIMP 2\32\lib\gimp\2.0\python\gimpfu.py", line 361, in run_script return apply(function, params) File "C:\Users\david\.gimp-2.8\plug-ins\Extreme_Unsharp_Desaturation_multi.py", line 15, in extreme_unsharp_desaturation_multi pdb.plug_in_unsharp_mask(tempimage, drawable, radius, amount, threshold) TypeError: wrong parameter type
|
|