Post Reply 

Run Deskew plugin from Python-Fu console

Aug 28, 2013, 10:57
Post: #1
Run Deskew plugin from Python-Fu console
I would like to run the (great!) Deskew plugin from the Python-Fu console, info: http://registry.gimp.org/node/2958
I'm a very GIMP Python-Fu beginner, so i followed what user "asperge" did in the post shown above (tested-working Script-Fu batch version):
get the image (active image), get the drawable (active layer) and finally run plugin "deskew_plugin".
I put deskew.exe in the GIMP plugin folder, i opened GIMP, i loaded an image, then in the Python-Fu console i wrote:

image=gimp.image_list()[0]
drawable=image.active_layer
pdb.gimp_deskew_plugin(image, drawable, 0, 0, 0, 0, 0)

I get this error:

Traceback (most recent call last):
File "", line 1, in
RuntimeError: calling error

The working Script-Fu calling was:
(gimp-deskew-plugin 0 image drawable 0 0 0 0 0)
The only difference from the asperge's Script-Fu working version is that in my Phyton version there's no "0" before "image".
I guess it's the "run mode" parameter. If i try to insert it, i have an error for too much parameters:

Traceback (most recent call last):
File "", line 1, in
TypeError: wrong number of parameters

I would really appreciate any help.
Thankyou!
(Windows 8 64 bit, GIMP 2.8.6)
Find all posts by this user
Quote this message in a reply
Aug 28, 2013, 13:52
Post: #2
RE: Run Deskew plugin from Python-Fu console
(Aug 28, 2013 13:30)ofnuts Wrote:  You guessed right for the first parameter.

What is the description of the parameters in the plugin browser (I don't run that plugin)?

Thank you for the support!
I attach the printscreen.
At the end the parameters are quite simple.
Maybe there's an error on "drawable"? I'm pretty sure to pass it correctly with "image.active_drawable"...

[Image: 0ndyeI7.png?1]
Find all posts by this user
Quote this message in a reply
Aug 28, 2013, 21:24 (This post was last modified: Aug 28, 2013 21:26 by ramonvaldezz.)
Post: #3
RE: Run Deskew plugin from Python-Fu console
(Aug 28, 2013 20:32)ofnuts Wrote:  Check the type of "drawable": "type(drawable)" should return "<type 'gimp.Layer'>".

Otherwise for the randomize parameter, use "True" or "False" instead of 1 or 0.

After that I am short on ideas without installing the plugin.

Thank you for your kind help.
I tried what you suggested, but without success.
If you want try, i attached the plugin.
This is the window were you can see that the DRAWABLE is a LAYER, and that the TRUE or FALSE try didn't succed.

[Image: 2hgwq5t.png]


Attached File(s)
.zip  deskew.zip (Size: 20.94 KB / Downloads: 66)
Find all posts by this user
Quote this message in a reply
Aug 29, 2013, 08:52
Post: #4
RE: Run Deskew plugin from Python-Fu console
Ofnuts, thank you for the help and the time you are given to me.
It is a recent build.
I run GIMP 64 bit on Windows 8 64 bit. The plugin runs correctly when fired from menu. It works also when executed in batch following what user "asperge" did in the official post (Script-fu version) http://registry.gimp.org/node/2958
The repository of souce code is:
https://github.com/prokoudine/gimp-deskew-plugin
What i would like to do is just execute it from python console.
Thanks again!
Find all posts by this user
Quote this message in a reply
Aug 30, 2013, 13:15
Post: #5
RE: Run Deskew plugin from Python-Fu console
Hi Kevin,
i saw the Rod's post you cited. The Rod's compiled version causes an error at GIMP startup (for my config, GIMP 2.8.6 on Windows 8 64 bit) and doesn't appear in the Layer menu.
I still don't understand where could be the problem.
Thank you for you help.
I'm sorry if cross-posting is unpolite...
Find all posts by this user
Quote this message in a reply
Aug 30, 2013, 13:15
Post: #6
RE: Run Deskew plugin from Python-Fu console
Hi Kevin,
i saw the Rod's post you cited. The Rod's compiled version causes an error at GIMP startup (for my config, GIMP 2.8.6 on Windows 8 64 bit) and doesn't appear in the Layer menu.
I still don't understand where could be the problem.
Thank you for you help.
I'm sorry if cross-posting is unpolite...
Find all posts by this user
Quote this message in a reply
Aug 30, 2013, 13:55
Post: #7
RE: Run Deskew plugin from Python-Fu console
I had the same impression too...but because of i'm very new to GIMP Python and Script, i cannot figure out how to understand the source code. This is why i took the compiled version i found in the official thread. By the way, the plugin is so useful that is a pity that cannot be implemented in Python plugin (e.g. batch and so on).
Find all posts by this user
Quote this message in a reply
Aug 30, 2013, 15:39
Post: #8
RE: Run Deskew plugin from Python-Fu console
Yes, i had the same idea too. Of course, that will be the last resource...
Find all posts by this user
Quote this message in a reply
Aug 30, 2013, 15:39
Post: #9
RE: Run Deskew plugin from Python-Fu console
Yes, i had the same idea too. Of course, that will be the last resource...
Find all posts by this user
Quote this message in a reply
Aug 30, 2013, 16:27 (This post was last modified: Aug 30, 2013 16:29 by ramonvaldezz.)
Post: #10
RE: Run Deskew plugin from Python-Fu console
You got the point. That's exactly what i wonder. Any resource i read about Python-Fu seems say that Python automatically passes the run mode. That's true for all the procedures you can find in procedure browser: the first argument (=RUN MODE) is never passed in Python calls. Maybe we can follow the wrapper-approach adding a SF_RUNMODE=0 but like you i don't know how to do it...
Find all posts by this user
Quote this message in a reply
Aug 30, 2013, 16:45
Post: #11
RE: Run Deskew plugin from Python-Fu console
GREAT!!!! It works!!!!
Thankyou Paynekj....i was loosing hope!!!
I add [solved] to this post.
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Run script on action rchav 2 113 Aug 13, 2018 14:57
Last Post: rchav
  GIMP Resynthesizer Plugin not working Mikkel Andersen 1 466 Jun 26, 2018 16:36
Last Post: paynekj
  Gimp 2.10 with old vignette from Plugin registry. DenisT 2 318 May 19, 2018 20:42
Last Post: DenisT
  Export Layers Plugin not working with 2.10? Imc7r 2 342 Apr 30, 2018 14:22
Last Post: Imc7r
Question beautify plugin ! i can not install it! unknown7 3 553 Feb 12, 2018 21:02
Last Post: unknown7

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS