02-29-2024, 12:48 AM
(02-29-2024, 12:22 AM)gimpygirl Wrote:(02-28-2024, 11:08 PM)Ofnuts Wrote: If you mean the folder form the image, then:
So you code looks like:
- Given timg
- timg.filename is the complete path to the file the image was loaded from
- os.path.dirname(some_path) extracts the parent directory in a path
- so what you want is in os.path.dirname(timg.filename)
Code:
import os # somewhere at the top of your file, otherwise os.path.dirname won't be resolved
pdb.python_fu_ofn_export_layers(timg, os.path.dirname(timg.filename)), "{numUp0}.png", "-", 0)
I have a working small plugin.
At the top is this
Code:
from gimpfu import*
When adding
Code:
import os
above or below this line and adding the line you gave me, the plugin does not appear anymore in GIMP.
If I remove the line, it appears again
Oops, extra parenthesis after timg.filename, try:
Code:
pdb.python_fu_ofn_export_layers(timg, os.path.dirname(timg.filename), "{numUp0}.png", "-", 0)