It is currently Sun Jun 30, 2024 3:14 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Learning to do first Python script
PostPosted: Tue Apr 07, 2020 1:36 pm  (#1) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
Hi I"m trying to learn python scripting, (I took advise from ofnuts, thank you) and I'm trying to create my first simple plugin "Extreme Canvas texturing". The problem is that is not registering with GIMP, it doesn't appear on the menu Scrip-fu. Any help will be appreciated. I want to let you know that I'm a 59 old but I'm in first grade in Python scripting, so be gentle! Thank you in advanced.


This is the script so far:

#!/usr/bin/env python

from gimpfu import *

def python_extreme_canvas_texturing(image, drawable):
   #Run the unsharp mask, radius 3, amount 3, threshold 0,
   #Run desaturate, lightness mode,
   radius= 3.0
   amount= 3.0
   threshold= 0
   pdb.plug_in_unsharp_mask(image, drawable, radius, amount, threshold)
   
   #Run apply canvas, light direction top right,
   direction= TOP_RIGHT
   depth= 10
   pdb.plug_in_apply_canvas(image, drawable, direction, depth)
   
   





register(
    "python_extreme_canvas_texturing",
    "Extreme canvas",
    "Create and extreme canvas on image",
    "Pocholo",
    "Pocholo",
    "April 7, 2020",
    "<Image>/Python-Fu/Extreme canvas texture...",
   "RGB",
   [
      (PF_IMAGE,    "ïmage",  "take current image", "None"),
      (PF_DRAWABLE, "drawable",  "input layer", "None"),
    ],
   [],
   python_extreme_canvas_texturing)

   
main()

_________________
https://www.deviantart.com/pocholo17
Image


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Learning to do first Python script
PostPosted: Tue Apr 07, 2020 2:34 pm  (#2) 
Offline
GimpChat Member

Joined: Mar 04, 2011
Posts: 2435
Your i in "image" is not an i ;) That gets it registered but not a lot happens.

Attachment:
not-an-i.jpg
not-an-i.jpg [ 55.72 KiB | Viewed 2363 times ]

_________________
Image


Top
 Post subject: Re: Learning to do first Python script
PostPosted: Tue Apr 07, 2020 2:45 pm  (#3) 
Offline
GimpChat Member
User avatar

Joined: Dec 26, 2014
Posts: 198
I got it working after making 3 changes

TOP_RIGHT is not defined

the two lines below were deleted/not required
(PF_IMAGE, "ïmage", "take current image", "None"),
(PF_DRAWABLE, "drawable", "input layer", "None"),

comma missing at end of line python_extreme_canvas_texturing)

steve


Last edited by Steve on Tue Apr 07, 2020 2:51 pm, edited 1 time in total.

Top
 Post subject: Re: Learning to do first Python script
PostPosted: Tue Apr 07, 2020 2:51 pm  (#4) 
Offline
GimpChat Member
User avatar

Joined: Apr 15, 2017
Posts: 1826
Running in terminal, it reports error in line 34:

line 34
SyntaxError: Non-ASCII character '\xc3' in file /home/racer/.config/GIMP-AppImage/2.10/plug-ins/01-test.py on line 34, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details


Top
 Post subject: Re: Learning to do first Python script
PostPosted: Tue Apr 07, 2020 2:59 pm  (#5) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
Thank you guys, you are Awesome!

_________________
https://www.deviantart.com/pocholo17
Image


Top
 Post subject: Re: Learning to do first Python script
PostPosted: Tue Apr 21, 2020 4:53 pm  (#6) 
Offline
GimpChat Member
User avatar

Joined: Apr 18, 2020
Posts: 7
I was also having a problem writing my first script. What I found out that helped me was to start gimp in verbose mode.

The easiest way to do this is use the verbose flag (--verbose) when starting gimp.

Thanks


Top
 Post subject: Re: Learning to do first Python script
PostPosted: Wed Apr 22, 2020 2:47 am  (#7) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4752
See also: https://www.gimp-forum.net/Thread-Debug ... in-Windows

_________________
Image


Top
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) My first Python Script for Gimp

7

No new posts .py script not showing under Python-Fu

3

No new posts Does anyone have script fu and python plugins that work on 2.99.19?

1

No new posts Can a python script use gimpfu, run from terminal, and create new img?

2

No new posts Eager to learn to input text in python script (Solved)

2


cron

* Login  



Powered by phpBB3 © phpBB Group