Can someone please help me for my first gimp script ?
I have a gimp file with these layers : a, b1, b2, c, d1, d2 and e.
I would like to do a script which exports several images from this gimp file. I need this script does a selection of the layers for each export, I wish in fact this :
image1.png : only with layers a, b1, c, d1 and e. (layers b2 and d2 are hidden)
image2.png : only with layers a, b1, c, d2 and e. (layers b2 and d1 are hidden)
image3.png : only with layers a, b2, c, d1 and e. (layers b1 and d2 are hidden)
image4.png : only with layers a, b2, c, d2 and e. (layers b1 and d1 are hidden)
So can someone explain me :
1. How to do loops,
2. How to switch on/off layers,
3. How to export ?
12-03-2021, 05:22 PM (This post was last modified: 12-03-2021, 05:24 PM by Ofnuts.)
(12-03-2021, 04:17 PM)aka Wrote: Hi,
Can someone please help me for my first gimp script ?
I have a gimp file with these layers : a, b1, b2, c, d1, d2 and e.
I would like to do a script which exports several images from this gimp file. I need this script does a selection of the layers for each export, I wish in fact this :
image1.png : only with layers a, b1, c, d1 and e. (layers b2 and d2 are hidden)
image2.png : only with layers a, b1, c, d2 and e. (layers b2 and d1 are hidden)
image3.png : only with layers a, b2, c, d1 and e. (layers b1 and d2 are hidden)
image4.png : only with layers a, b2, c, d2 and e. (layers b1 and d1 are hidden)
So can someone explain me :
1. How to do loops,
2. How to switch on/off layers,
3. How to export ?
Thanks
Have you got specific names on the layers or are the mutually exclusive layers in a group?
Also, what is the export format and do you need specific format-related settings (JPEG quality...)?
(12-03-2021, 05:22 PM)Ofnuts Wrote: Have you got specific names on the layers or are the mutually exclusive layers in a group?
Also, what is the export format and do you need specific format-related settings (JPEG quality...)?
Hi,
a, b1,.. are the names of the layers, I tought I put the gimp file with my first post.
I draw myself the pictures in gimp (with a wacom tablet), they are with colors and look like cartoons figures. I heard that, in this case, png is better than jpeg. Sorry, I have no ideas about specific format-related settings to choose ; perhaps can you give me an advice for that too ?
And impossible for me to see the script in Gimp... I tried a lot of things, but it seems that something is missing :
devel@k0:~/.config/GIMP/2.10/plug-ins$ ./ofn-export-layers-combinations.py
Traceback (most recent call last):
File "./ofn-export-layers-combinations.py", line 30, in <module>
from gimpfu import *
ImportError: No module named gimpfu
root@k0:~# apt-get install gimp-python
Lecture des listes de paquets... Fait
Construction de l'arbre des dépendances... Fait
Lecture des informations d'état... Fait
E: Impossible de trouver le paquet gimp-python
I had some success on a debian buster. I installed gimp and gimp-python packages, put your script in /home/pi/.config/GIMP/2.10/plug-ins/ and :
1. I had to change the line
exportMenu='<Image>/File/Export/'
to
exportMenu='<Image>'
to see the script in gimp (I have a french menu, perhaps that changes something?)
2. When I run the script on the same image, I have only one (attached) file exported.