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 - <<EOF Before jsbueno posted his answer I had also tried asking on the #gimp IRC channel.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |