It is currently Thu Jun 27, 2024 9:49 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Python calling G'MIC filter? (Solved)
PostPosted: Tue May 19, 2020 11:03 am  (#1) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
Hi guys, it's me again. I'm trying to learn how to call a G"MIC filter in python. I cannot find anything in the internet that can give me a solid sample or how to make the function work. So far i have and it's not making anything to the image:

pdb.plug_in_gmic_qt(img, layer, 0, 0 "relief_light 0.1, 0, 0, 0, 0.3, 0, 0, 0, 0.03, 0, 0.3")



I'm trying to create an Orange peel texture using one of conbagui's tutorial that uses the G'MIC plugin. this is the rest of the script;

from gimpfu import *

def orange_peel_texture(scale):

   imgSize = 500
   
   #Create the orange peel
   img = pdb.gimp_image_new(imgSize, imgSize, RGB)
   layer = pdb.gimp_layer_new(img, imgSize, imgSize, RGB, "Orange peel", 100, LAYER_MODE_NORMAL)
   pdb.gimp_image_add_layer(img, layer, 0)
   pdb.gimp_context_set_foreground((241, 152, 56))
   pdb.gimp_drawable_fill(layer, FILL_FOREGROUND)
   pdb.plug_in_hsv_noise(img, layer, 8, 3, 4, 150)
   
   pdb.plug_in_gmic_qt(img, layer, 0, 0 "relief_light 0.1, 0, 0, 0, 0.3, 0, 0, 0, 0.03, 0, 0.3")
   
   
   gimp.Display(img)
   
   



register(
   "orange_peel_texture",
   "Creates an orange peel texture",
   "Creates an orange peel texture",
   "Pocholo",
   "Pocholo",
   "2020",
   "Orange peel",
   "",

[
   
   (PF_SPINNER, "scale", "Scale", 500, (1, 1000, 1)),

],


[],
orange_peel_texture, menu="<Image>/Python-Fu/orange_peel_texture")

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


Last edited by Pocholo on Tue May 19, 2020 7:59 pm, edited 1 time in total.

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: Python calling G'MIC filter?
PostPosted: Tue May 19, 2020 11:10 am  (#2) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
layer can't have as creation parameter RGB, but RGB_IMAGE

look
Attachment:
Cattura.PNG
Cattura.PNG [ 28.2 KiB | Viewed 2118 times ]

_________________
"Where am I ?"


Top
 Post subject: Re: Python calling G'MIC filter?
PostPosted: Tue May 19, 2020 1:02 pm  (#3) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
Thank you dinasset, but that doesn't help what I'm trying to accomplish. I had others script on , RGB mode and they all work fine without the RGB_IMAGE mode. I did changed it and it's giving me an error.

Image

How do I write a function call a G"MIC filter in python that work? Thank you in advanced!

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


Top
 Post subject: Re: Python calling G'MIC filter?
PostPosted: Tue May 19, 2020 2:21 pm  (#4) 
Offline
GimpChat Member
User avatar

Joined: Jan 20, 2013
Posts: 14816
Location: roma, italy
Something like this? (warning, these are NOT your parameters, change as you like but keep the structure):
   pdb.plug_in_gmic_qt(img, layer, 1, 0 ,
        "-v - -fx_light_relief 1,0,0,0,1,50,50,5,0.5,0,0 ")

_________________
"Where am I ?"


Top
 Post subject: Re: Python calling G'MIC filter?
PostPosted: Tue May 19, 2020 3:48 pm  (#5) 
Offline
GimpChat Member

Joined: Jul 28, 2018
Posts: 1196
Thanks a lot, dinasset it worked.

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


Top
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Attachment(s) How to call a python filter to run interactively

10

No new posts Attachment(s) use of a color curves preset in a python filter

42

No new posts Calling GIMP Plug-in From Command Line - on Windows

0

No new posts Convert GIMP plugin from Python 2 to Python 3

4

No new posts Attachment(s) cli345's cartoon filter as a native GEGL Filter.

10



* Login  



Powered by phpBB3 © phpBB Group