I have a batch processing script in GIMP that, for every image file in a directory, involves importing the image, importing a background image as a layer, doing some edits, and exporting the image. The edits take no time at all but the gimp-file-load, gimp-file-load-layer, and gimp-file-save steps take a combined total of 3-4 seconds for a 69x96 .tga image and so the batch process will take the better part of a day to handle thousands of files.
Is there a faster way to import/export these images GIMP? Maybe I can eliminate the background import step by keeping the background image open until the batch process is complete. But then what would I use in place of
(gimp-file-load-layer 1 image background)
to add the background image as a layer? I don't know of any procedures that can transfer data between two images, open in GIMP or not, without using clipboard (which I'm already using to transfer alpha channel data) or file-load.