【发布时间】:2020-04-19 22:26:03
【问题描述】:
我想写一个简单的脚本:1)使图像缩小 25%(宽 50%,高 50%),2)从另一个图像中添加水印(最后我想为它设置不透明度20%)。
我的问题是我不完全了解我如何处理我创建的图层。对于一堆文件,脚本有效(但让它工作很痛苦!),我更改了参数,但似乎我无法让它按我想要的方式工作)。我看不到水印图像-除非我为drawable2 做gimp-file-save(那时只有水印)。
有人可以帮我吗? - 并向我解释我在这里做错了什么?
(define (add-watermark2 pattern waterm)
(let* ((filelist (cadr (file-glob pattern 1))))
(while (not (null? filelist))
(let* ((filename (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
(drawable (car (gimp-image-active-drawable image)))
(cur-width (car (gimp-image-width image)))
(cur-height (car (gimp-image-height image)))
(width (* 0.50 cur-width))
(height (* 0.50 cur-height))
(gimp-image-scale image width height) ; scale the image
(drawable2 (car (gimp-file-load-layer RUN-NONINTERACTIVE image waterm)))
(gimp-image-insert-layer image drawable2 0 -1)
(gimp-layer-set-offsets drawable2 100 100 )
(gimp-layer-set-mode drawable2 0)
(gimp-image-merge-visible-layers image 2)
)
(gimp-file-save RUN-NONINTERACTIVE image drawable (string-append "w" filename) "")
)
(set! filelist (cdr filelist))
)))
【问题讨论】:
标签: layer watermark gimp script-fu