

Pdb.gimp_file_save(img, layer, new_name, new_name) Layer = pdb.gimp_image_merge_visible_layers(img, gimpfu.CLIP_TO_IMAGE) Img = pdb.gimp_file_load(filename, filename) SO, since you said you don't want to save new scripts (you could do it because you can add new plug-in and scripts directories on edit->preferences->folder options so that you don't need to write on ~/.gimp*/plugins/)Īnyway, you can open the python console under filters, and paste this snippet in the interactive prompt. Script-fu uses GIMP's built-in scheme implementation, which is extremely poor in handling I/O (such as listing files in a directory) - a task which is absolutely trivial in Python. There are a few ways to go through this - my preferred method is always developing a GIMP-Python plug-in. I'm posting this answer just in case someone needs a way to do this without the use of GIMP-Python (perhaps because it isn't installed). It also side-steps the issue of getting parameters from the shell into gimp. The glob approach is used to avoid starting up GIMP for each image.

This scriptfu globs for xcf files, and then for each file it loads the file, merges the visible layers, saves the result as a PNG, and "unloads" the image. (gimp-file-save RUN-NONINTERACTIVE image layer filename filename) (set! filename (string-append (substring (car file's) 0 (- (string-length (car file's)) 4)) ".png")) (set! layer (car (gimp-image-merge-visible-layers image CLIP-TO-IMAGE))) (set! image (car (gimp-file-load RUN-NONINTERACTIVE (car file's) (car file's)))) I was directed to this thread on Gimptalk which contains the following code: gimp -n -i -b - <
