Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Py-fu problem

24 views
Skip to first unread message

Jim Sabatke

unread,
Nov 11, 2007, 10:15:27 PM11/11/07
to
I've been struggling with this for a couple days. I assume it's a
simple solution that should be obvious to me, but I just plain haven't
found the answer and I've been reduced to just trying things at random.

I want to add a layer of lens distortion to the photo being edited, and
this function call:

# add lens distortion
pdb.plug_in_lens_distortion(RUN_NONINTERACTIVE,timg,tdrawable,1.1,refractive_index,1.1,1.1)

returns an error:

# start error text

Traceback (most recent call last):
File "/opt/gnome/lib/gimp/2.0/python/gimpfu.py", line 662, in response
dialog.res = run_script(params)
File "/opt/gnome/lib/gimp/2.0/python/gimpfu.py", line 347, in run_script
return apply(function, params)
File "/home/jim/.gimp-2.4/plug-ins/lomo.py", line 56, in python_lomo

pdb.plug_in_applylens(RUN_NONINTERACTIVE,timg,tdrawable,refractive_index,True,False,False)
TypeError: wrong number of parameters

# end error text

I've done everything I can think of, including hard-coding values as
arguments.

Can anyone help?

TIA,

Jim

Floyd L. Davidson

unread,
Nov 12, 2007, 3:47:48 AM11/12/07
to
Jim Sabatke <jsab...@gmail.com> wrote:
>I've been struggling with this for a couple days. I assume it's a
>simple solution that should be obvious to me, but I just plain haven't
>found the answer and I've been reduced to just trying things at random.
>
>I want to add a layer of lens distortion to the photo being edited, and
>this function call:
>
># add lens distortion
>pdb.plug_in_lens_distortion(RUN_NONINTERACTIVE,timg,tdrawable,1.1,refractive_index,1.1,1.1)

Your function call above actually does have an incorrect
number of arguments. The documentation says it requires,

run-mode INT32
image IMAGE
drawable DRAWABLE
offset-x FLOAT
offset-y FLOAT
main-adjust FLOAT
edge-adjust FLOAT
rescale FLOAT
brighten FLOAT

However, the pdb.plug_in_*() functions, which are all
listed with a run-mode argument, from python-fu do not
actually want to see that argument, so it has to be
called as

pdb.plug_in_lens_distortion(image, drawable, offset_x,
offset_y, main_adjust, edge_adjust, rescale, brighten)

image IMAGE
drawable DRAWABLE
offset-x FLOAT
offset-y FLOAT
main-adjust FLOAT
edge-adjust FLOAT
rescale FLOAT
brighten FLOAT

I don't know what the reason for that is, and don't even
know if it is documented. I just happened to see that
in the several python scripts that come with GIMP source
code, the pdb.plug_in_* functions were all being called
that way.

--
Floyd L. Davidson <http://www.apaflo.com/floyd_davidson>
Ukpeagvik (Barrow, Alaska) fl...@apaflo.com

Jim Sabatke

unread,
Nov 12, 2007, 7:56:09 AM11/12/07
to

Thank you Floyd. I never would have guessed that one.

Jim

0 new messages