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: 95)
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
Nov 17, 2018, 09:00 (This post was last modified: Nov 17, 2018 09:02 by dmig.)
Post: #12
RE: Run Deskew plugin from Python-Fu console
Hi everyone!

I stumbled upon this error and ended up finding a reason. The reason is simple: badly written plugin, it's non-interactive mode was broken. So passing
Code:
run_mode=gimpfu.RUN_INTERACTIVE (or just 0)
made it work.

(Aug 29, 2013 08:52)ramonvaldezz Wrote:  The repository of source code is:
ht1ps://github.com/prokoudine/gimp-deskew-plugin
This repository is deleted, but I made a fork and maintain it now: https://github.com/dmig/gimp-deskew-plugin
Find all posts by this user
Quote this message in a reply
Nov 18, 2018, 21:48
Post: #13
RE: Run Deskew plugin from Python-Fu console
This forum is had been DEAD for a long time.

The spammers keep trying to take over.

Save yourself from them and go to https://www.gimp-forum.net instead
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Wich plugin cold help me ? Alexandra 1 91 May 14, 2019 08:27
Last Post: paynekj
  How to install Gimp Heal Plugin (Linux)? ciararseeley 2 276 Mar 20, 2019 09:19
Last Post: paynekj
  Problem with the Twain Scanner Plugin klgrube 1 622 Feb 5, 2019 09:03
Last Post: paynekj
  python-fu file_dds_save wrong number of paramters ? Thial 1 856 Jan 14, 2019 09:28
Last Post: paynekj
  Run script on action rchav 2 1,576 Aug 13, 2018 14:57
Last Post: rchav

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS