Post all Gimp scripts and script writing questions here
Post a reply

wrong parameter type in pdb.plug_in_cubism

Wed May 06, 2020 9:43 am

Hi there,

I seem to have a pretty strange problem: a line of code
Code:
pdb.plug_in_cubism(layer, drawable, 20.5, 5.5, 0)

produces an error message which reads
wrong parameter type
.

he function from the Py-console is
Code:
pdb.plug_in_cubism(image, drawable, tile_size, tile_saturation, bg_color)
with tile_size - float, tile_saturation - float, bg_color - int32.

And I plain don't understand what am I doing wrong. Could you please help me with ideas? :bump

Re: wrong parameter type in pdb.plug_in_cubism

Wed May 06, 2020 10:43 am

Hi RockLizard
pdb.plug_in_cubism(layer,image, drawable, 20.5, 5.5, 0)

Re: wrong parameter type in pdb.plug_in_cubism

Thu May 07, 2020 11:05 am

Ow, thanks a million. This works. But somehow it affects only a layer. This is why I got confused in the first place... Should go and learn more about image and layer concepts...

MareroQ wrote:Hi RockLizard
pdb.plug_in_cubism(layer,image, drawable, 20.5, 5.5, 0)

Re: wrong parameter type in pdb.plug_in_cubism

Thu May 07, 2020 5:46 pm

RockLizard wrote:Ow, thanks a million. This works. But somehow it affects only a layer. This is why I got confused in the first place... Should go and learn more about image and layer concepts...

MareroQ wrote:Hi RockLizard
pdb.plug_in_cubism(layer,image, drawable, 20.5, 5.5, 0)


Most things you do "by hand" in Gimp only affect a layer and not the whole image.....

Re: wrong parameter type in pdb.plug_in_cubism

Sat May 09, 2020 10:26 am

ofnuts wrote:Most things you do "by hand" in Gimp only affect a layer and not the whole image.....


I am lost again. Is there a way to apply "manual" operation to every layer/batch of files, except external script calling GIMP for every image? I tried changing layers order and assigning new active layer and it did not work(

Re: wrong parameter type in pdb.plug_in_cubism

Sat May 09, 2020 11:46 am

If you have Windows OS, have you tried "BIMP"? it integrate with GIMP.
https://alessandrofrancesconi.it/projects/bimp/

Re: wrong parameter type in pdb.plug_in_cubism

Sat May 09, 2020 1:01 pm

RockLizard wrote:I am lost again. Is there a way to apply "manual" operation to every layer/batch of files, except external script calling GIMP for every image? I tried changing layers order and assigning new active layer and it did not work(


BIMP works very well for individual images, use "other gimp procedure"

For a single image and a stack of layers, this a skeleton for you to improve on.

Code:
#!/usr/bin/env python
from gimpfu import *

def testing (layer, drawable ):

    image = gimp.image_list()[0]
    for layer in image.layers:
        pdb.plug_in_cubism(image, layer, 20.5, 5.5, 0)

register(
   "python_fu_testing",
   " ",
   " ",
   "",
   " ",
   "2020",
   "<Image>/Tools/testing",
   "*",
   [],
   [],
   testing,
         )
main()


...and do not ask me, I am no coder ;)

Re: wrong parameter type in pdb.plug_in_cubism

Sat May 09, 2020 3:19 pm

rich2005 wrote:
RockLizard wrote:I am lost again. Is there a way to apply "manual" operation to every layer/batch of files, except external script calling GIMP for every image? I tried changing layers order and assigning new active layer and it did not work(


BIMP works very well for individual images, use "other gimp procedure"

For a single image and a stack of layers, this a skeleton for you to improve on.

Code:
#!/usr/bin/env python
from gimpfu import *

def testing (layer, drawable ):

    image = gimp.image_list()[0]
    for layer in image.layers:
        pdb.plug_in_cubism(image, layer, 20.5, 5.5, 0)

register(
   "python_fu_testing",
   " ",
   " ",
   "",
   " ",
   "2020",
   "<Image>/Tools/testing",
   "*",
   [],
   [],
   testing,
         )
main()


...and do not ask me, I am no coder ;)


Good try, but "image = gimp.image_list()[0]" retrieves one image among the ones that are open, and that may not be the active one, so as written the script is quite dangerous... In fact the first argument of your function (the one you call "layer") is the image you are working on and not a layer, so you code could start with:

Code:
#!/usr/bin/env python
from gimpfu import *

def testing (image, drawable ):

    for layer in image.layers:
        pdb.plug_in_cubism(image, layer, 20.5, 5.5, 0)

Re: wrong parameter type in pdb.plug_in_cubism

Sun May 10, 2020 3:14 am

:tyspin will remember it, as I am not a codes as well, and I am also nearly 0 in GIMP particularities.
rich2005 wrote:
RockLizard wrote:I am lost again. Is there a way to apply "manual" operation to every layer/batch of files, except external script calling GIMP for every image? I tried changing layers order and assigning new active layer and it did not work(


BIMP works very well for individual images, use "other gimp procedure"

For a single image and a stack of layers, this a skeleton for you to improve on.

Code:
#!/usr/bin/env python
from gimpfu import *

def testing (layer, drawable ):

    image = gimp.image_list()[0]
    for layer in image.layers:
        pdb.plug_in_cubism(image, layer, 20.5, 5.5, 0)

register(
   "python_fu_testing",
   " ",
   " ",
   "",
   " ",
   "2020",
   "<Image>/Tools/testing",
   "*",
   [],
   [],
   testing,
         )
main()


...and do not ask me, I am no coder ;)

Re: wrong parameter type in pdb.plug_in_cubism

Sun May 10, 2020 3:15 am

Pocholo wrote:If you have Windows OS, have you tried "BIMP"? it integrate with GIMP.
https://alessandrofrancesconi.it/projects/bimp/


Works perfect for the task (with some corrections). Thank you!
Post a reply