Wenn ich versuche, das folgende Python-Skript durch GIMP gui zu laufen:Typeerror: export_png() nimmt genau 3 Argumente (4 gegeben)
#!/usr/bin/env python
from gimpfu import *
def export_png(image, drawable, self):
filename=image.name
interlace=0
compression=0
bkgd=0
gama=0
off=0
phys=0
time=0
pdb.file_png_save(image, drawable, filename, raw_filename, interlace, compression, bkgd, gama, offs, phys, time)
register(
"python_fu_export_png",
"Exports the current image as png",
"Exports the current image as png",
"HHP",
"HHP",
"2017",
"<Image>/Image/Export as png",
"*",
[
(PF_IMAGE, "image", "takes current image", None),
(PF_DRAWABLE,"drawable", "input layer",None),
],
[],
export_png
)
main()
ich diesen Fehler:
Traceback (most recent call last):
File "/Applications/GIMP.app/Contents/Resources/lib/gimp/2.0/python/gimpfu.py", line 736, in response
dialog.res = run_script(params)
File "/Applications/GIMP.app/Contents/Resources/lib/gimp/2.0/python/gimpfu.py", line 361, in run_script
return apply(function, params)
TypeError: export_png() takes exactly 3 arguments (4 given)
Warum ist Das? Ich dachte, dass ich PF_Image und PF_DRAWABLE nur in die Funktion übergebe, warum sage ich, dass ich vier Argumente gebe?
Selbst wird auch als Argument übergeben, wenn es das erste sein soll (und muss nicht angegeben werden) – jhpratt