I'm trying to write a plugin for GIMP, which looks like following:
#!/usr/bin/python3
import os
from gimpfu import *
def run(image, drawable, directory):
layers = image.layers
for layer in layers:
if pdb.gimp_item_is_group(layer): # Check if the layer is a GroupLayer
filename = directory + os.sep + layer.name + ".png"
pdb.file_png_save(image, layer, filename, filename, 0, 9, 1,1,1,1,1)
# Destroy the new image:
register(
"export-layer-groups",
"Export layers",
"Export layer groups as png images",
"Lukasz Michalczyk",
"LM",
"2020",
"<Image>/File/Export layer groups..",
"*",
[
(PF_DIRNAME, "directory", "Directory", None),
],
[],
run)
main()
I've put it in a file called "export_layers_as_images.py" and moved the file into "~/.config/GIMP/2.10/plug-ins" directory.
I'm using Linux Mint OS. When I start GIMP, I get the following error:
Traceback (most recent call last):
File "/home/lukasz/.config/GIMP/2.10/plug-ins/export_layers_as_images.py", line 3, in <module>
from gimpfu import *
ImportError: No module named gimpfu
How can I solve this issue? I have an idea that the Python interpreter at the shebang is wrong, and if so, what do I use?