gpt4 book ai didi

Gimp 批处理打开为图层

转载 作者:行者123 更新时间:2023-12-04 00:29:51 24 4
gpt4 key购买 nike

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

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

我的代码如下所示:

(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)
))

最佳答案

对于非交互模式:

(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)

关于Gimp 批处理打开为图层,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29328773/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com