Search code examples
gimppython-fu

parameter type documentation for pdb.file_png_save2


Error message from gimp - pdb.file_png_save2(...) (wrong parameter type) - parameters seem to follow doc but still gives error...

In a plug-in/script module I am trying to save a .png file. I am using pdb.file_png_save2() because I need to preserve transparency. I am getting nowhere. The following is from the python-fu console.

>>> img=gimp.image_list()[0]
>>> lyr=img.layers[0]
>>> pdb.file_png_save2(img, lyr, "/tmp/untitled14.png", "untitled14.png", False, 9, False, False, False, False, False, "", True)
Traceback (most recent call last):
   File "<input>", line 1, in <module>
TypeError: wrong parameter type

And just to verify that the objects are valid --->

>>> img
<gimp.Image 'I230112341bgsl.jpg'>
>>> lyr
<gimp.Layer 'Background'>
>>> 

So, which parameter is wrong type. And if so where is there any real documentation (ie not from the pdb browser 'explanation' - because that is obviously insufficient)


Solution

  • The comment (next to last) should be a Boolean (type INT32 in the documentation...). It is not the comment itself, but tells if the image comment (from Image>Properties) is written.

    The PDB is usually sufficient. Of course it is generated from the docs more meant for script-fu but the mappings are reasonably consistent.