Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Automated merging and export
Hello everybody !

I'm glad to find an active forum about this marvelous tool^^

So... ! I'm here about a very boring project, and I thought I can find some experts to give me one or two advices...  Shy

Here is the things I need to do :

- import a png file into a .xcf
- put this new layer between two other layers (for eg. Color2 and Color3, and I want my new png file to be slipped between them !)
- export the whole thing as a new png !

And I have to do this for some hundreds files  Confused

Do you know if it exists scripts I can use to make a batch, instead of doing it manually ?

Thanks a lot, have a nice day !
Nothing Gimp I know of off-the-shelf: Maybe someone will come up with one. Otherwise it is write your own script and one of the clever guys might give advice.

However for batch operations ImageMagick is better. It is command line and you will need to include the commands in a Windows batch file with a variable for the individual images. Use png's rather than .xcf

For example: To add the 'variable' image to a fixed bottom layer
composite -gravity Center 01.png bg.png temp.png

Then add the 'top' layer to the previous combined layer essentially the same command
composite -gravity Center logo.png temp.png 01-combined.png

and delete the temporary file
del temp.png

That sequence gives this.
Thank you for your answer!

At first I thought "Hmm, nice, but I don't think it could do what I need", since I have multiple layers packed in folders (what I named "Color 2" and "Color3" in my first post Smile )
But by merging each of these folders in one png, I think you solution could make it !

Still, there is one issue: some layers have a particular Mode: I got one with "soft light" (I use Gimp in french I don't know if this is the correct term in english), and another one with Color LcH. Obviously when I merge the foler in one pic, these Modes are lost...

These two layers are not absolutely necessary, but do you see any solution to keep them with their original blending modes ?

ps : to be clear, here is the organization of my xcf :

- Color1 (a folder)
-- layer 1 (normal blending)
-- layer 2 (normal blending)

-Color2 (a folder)
-- layer 3 (normal blending)
-- layer 4 (normal blending)
-- layer 5 (soft light blending)
-- layer 6 (normal blending)

- layer 7 (not in a folder ; color LcH blending mode)

- Here I want to put my picture !

- layer 8 (the background pic)

(So the idea was to merge the Color1 + Color2 + layer 7, and then use your method)
Anyway, your solution is very good.
I create a .bat using a slightly modified version:

for /L %%i in (1,1,100) do magick composite -gravity center *%%i.png bg.png *%%i.png automatically transforms 100 pictures (named picture1, picture2, etc., the * is for the word "picture", and the %%i for the number - use only %i if using the command prompt instead of a .bat), into news pics with the wanted background.

After that I just had to do the same with my "topping" pic, as you said:

for /L %%i in (1,1,100) do magick composite -gravity center topping.png *%%i.png *%%i.png

And I got my pics with the "top" layer ! It was like making a cake^^
I lost two layers in the process, but it was so much a timesaver, it worth it...! Thank you very much rich2005 !

Forum Jump: