It is currently Thu Sep 10, 2026 4:41 pm


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Simple Plugin is failing to execute
PostPosted: Mon Jul 28, 2025 7:17 am  (#1) 
Offline
New Member

Joined: Jul 28, 2025
Posts: 3
Hello everybody,

with the help of AI I wrote a simple script for automating the first steps when processing polaroid pictures. Obviously AI is **** at this and I have no clue what I'm doing either, so I'm running into issues.

Apparently I can't post the script code here because the forum thinks it contains too many URLs for a new user - obviously there is no URLs here. I also can't upload it since the forum doesn't allow *.py files :/

I'll try adding the script as a separate post as an answer to this.

The script shows up correctly under Filters > Custom. But on execution nothing happens - I get no messages or error messages, neither in a terminal nor in the Error Console of Gimp. Additionally, obviously nothing the plugin is supposed to do executes - no renaming of the layers, no duplication, no filters get applied.

I would be very grateful for any hints pointing me in the right direction.

I am on Windows 10, running Gimp 3.0.4

Cheers
SofD


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: Simple Plugin is failing to execute
PostPosted: Mon Jul 28, 2025 7:20 am  (#2) 
Offline
New Member

Joined: Jul 28, 2025
Posts: 3
I indeed can't post the code here. I tried attaching as a *.txt file, But thats also not allowed. I would be very grateful for any help on how to share my code and also on how to improve it if I manage to share it.


Top
 Post subject: Re: Simple Plugin is failing to execute
PostPosted: Mon Jul 28, 2025 9:33 am  (#3) 
Offline
GimpChat Member

Joined: Apr 11, 2024
Posts: 308
Ai won't help you with GIMP3 scripts. AI needs training data. But there is hardly anything for GIMP3 yet.
Once you have, I think 5 posts here you can write URLs and attach scripts.
Thanks to all those spammers we unfortunately have this rule.


Top
 Post subject: Re: Simple Plugin is failing to execute
PostPosted: Mon Jul 28, 2025 10:40 am  (#4) 
Offline
New Member

Joined: Jul 28, 2025
Posts: 3
Yea, I noticed it was having a hard time.
But from my basic understanding the script it came up with looks fine.
The main things I want to do are:
renaming and duplicating the active layer.
running filter > despeckle
running filter > sharpen (unsharp mask)

maybe someone can point me in the right direction on how I should call these funnctions?


Top
 Post subject: Re: Simple Plugin is failing to execute
PostPosted: Mon Jul 28, 2025 1:28 pm  (#5) 
Offline
GimpChat Member

Joined: Apr 11, 2024
Posts: 308
active_layer = Gimp.Image.get_selected_layers(image)[0]


new_layer = Gimp.Layer.copy(drawable)
Gimp.Image.insert_layer(image, new_layer, None, 0)


f = Gimp.DrawableFilter.new(layer, "gegl:unsharp-mask", "")
filter_config = f.get_config()
filter_config.set_property('std-dev', 3.0)  # radius
filter_config.set_property('scale', 0.25)  # amount
filter_config.set_property('threshold', 0.0)
# layer.append_filter(f)
layer.merge_filter(f)


Haven't found anything for despecle :-(

The GIMP 3 API is here:
https://developer.gimp.org/api/3.0/libgimp/index.html
Just enter what you are looking for in the search box

GEGL operations ( like unsharp mask) are here
https://gegl.org/operations/index.html

As an example ... find foggify.py in your installation. That shows you some very basic plug-in stuff.


Top
 Post subject: Re: Simple Plugin is failing to execute
PostPosted: Mon Jul 28, 2025 2:03 pm  (#6) 
Offline
GimpChat Member

Joined: Apr 11, 2024
Posts: 308
.... and despeckle goes like this:
procedure = Gimp.get_pdb().lookup_procedure('plug-in-despeckle')
config = procedure.create_config()
config.set_property('run-mode', Gimp.RunMode.NONINTERACTIVE)
config.set_property('image', image)
config.set_core_object_array('drawables', [drawable])
config.set_property('radius', radius)
config.set_property('type', type)
config.set_property('black', black)
config.set_property('white', white)
result = procedure.run(config)
success = result.index(0)


Of course you have to fill in your variables here ;-)


Top
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group