Gimp 批处理作为图层打开

Gimp batch open as layer

我在使用 gimp 批处理模式时遇到问题。我想要做的就是打开 2 个 png 文件作为一个图像的图层并将它们一起保存为一个图标 (.ico)。

问题:Gimp 只是将两个图像作为单独的 windows 打开,而不是作为一层中的两个图像。

我的代码如下所示:

(define (merge-to-icon filename layername endname)
(
    let* 
    (
        (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
        (drawable (car (gimp-image-get-active-layer image)))
        (adlayer (car (gimp-file-load-layer RUN-NONINTERACTIVE image layername)))
    )
    (gimp-image-insert-layer image adlayer 0 0)
    (set! drawable (car (gimp-image-get-active-layer image)))
    (gimp-displays-flush)
    (gimp-file-save RUN-NONINTERACTIVE image drawable endname endname)
))

对于non-interactive模式:

(define (implode-imgs-save-ico fname-one fname-two)
    (let* (
            ; first main image
            (image (car (gimp-file-load RUN-NONINTERACTIVE fname-one fname-one)))
            ; them layer
            (drawable1 (car (gimp-image-get-active-drawable image)))
            ; open image as layer
            (drawable2 (car (gimp-file-load-layer RUN-NONINTERACTIVE image fname-two)))
        )

        ; add layer to image
        (gimp-image-insert-layer image drawable2 0 0)

        ;set layer mixing mode
        (gimp-layer-set-mode drawable2 SCREEN-MODE)

        ; may be some resize here

        ; merge layers
        (set! drawable (car (gimp-image-flatten image)))

        ; save
        (file-ico-save RUN-NONINTERACTIVE image drawable "my.ico" "my.ico")
    )
)

然后调用它:

gimp --no-interface --batch='(moo "back.png" "top.png")' -b (gimp-quit 0)