GIMP Chat
http://gimpchat.com/

Python calling G'MIC filter? (Solved)
http://gimpchat.com/viewtopic.php?f=9&t=18362
Page 1 of 1

Author:  Pocholo [ Tue May 19, 2020 11:03 am ]
Post subject:  Python calling G'MIC filter? (Solved)

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")

Author:  dinasset [ Tue May 19, 2020 11:10 am ]
Post subject:  Re: Python calling G'MIC filter?

layer can't have as creation parameter RGB, but RGB_IMAGE

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

Author:  Pocholo [ Tue May 19, 2020 1:02 pm ]
Post subject:  Re: Python calling G'MIC filter?

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!

Author:  dinasset [ Tue May 19, 2020 2:21 pm ]
Post subject:  Re: Python calling G'MIC filter?

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 ")

Author:  Pocholo [ Tue May 19, 2020 3:48 pm ]
Post subject:  Re: Python calling G'MIC filter?

Thanks a lot, dinasset it worked.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/