Switch to full style
Post all Gimp scripts and script writing questions here
Post a reply

Python calling G'MIC filter? (Solved)

Tue May 19, 2020 11:03 am

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:

Code:
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;

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

Re: Python calling G'MIC filter?

Tue May 19, 2020 11:10 am

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

look
Cattura.PNG
Cattura.PNG (28.2 KiB) Viewed 2119 times

Re: Python calling G'MIC filter?

Tue May 19, 2020 1:02 pm

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!

Re: Python calling G'MIC filter?

Tue May 19, 2020 2:21 pm

Something like this? (warning, these are NOT your parameters, change as you like but keep the structure):
Code:
   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 ")

Re: Python calling G'MIC filter?

Tue May 19, 2020 3:48 pm

Thanks a lot, dinasset it worked.
Post a reply