我正忙于 Script-fu 并不断收到“错误(:1)非法功能”。我不是 Scheme/Lisp 专家,只是想自动化一些摄影任务。文档很少——要么 GiMP 只写了他们自己的内部操作,而不是 Script-fu 中的 Scheme 语法,要么我找到了 GiMP v1.0 的“提示”(即过时的它们没用)。
我查看了 GiMP 提供的一堆脚本,试图了解更多并弄清楚这一点,但无济于事。我在这里寻求帮助以消除错误,而不是缩进布局或 Python-fu 存在的事实等。
有了这个,代码(简化为功能框架):
;;
;; license, author, blah blah
;; FOR ILLUSTRATION PURPOSES
;; GiMP 2.8 LinuxMint 18.1
;; does the work, but then blows up saying "Error ( : 1) illegal function"
;;
(define (script-fu-ScriptFails InImage InLayer pickd mrge)
(let* (
(CopyLayer (car (gimp-layer-copy InLayer TRUE)) )
)
(gimp-image-undo-group-start InImage)
(gimp-image-add-layer InImage CopyLayer -1)
(gimp-drawable-set-visible CopyLayer TRUE)
;; Perform CHOSEN action on CopyLayer
(if (equal? pickd 0) ( ;; keep just the RED
(plug-in-colors-channel-mixer TRUE InImage CopyLayer FALSE 1.0 0 0 0 0 0 0 0 0)
(gimp-drawable-set-name CopyLayer "RED")
))
(if (equal? pickd 1) ( ;; keep just the GREEN
(plug-in-colors-channel-mixer TRUE InImage CopyLayer FALSE 0 0 0 0 1.0 0 0 0 0)
(gimp-drawable-set-name CopyLayer "GRN")
))
(if (equal? pickd 2) ( ;; keep just the BLUE
(plug-in-colors-channel-mixer TRUE InImage CopyLayer FALSE 0 0 0 0 0 0 0 0 1.0)
(gimp-drawable-set-name CopyLayer "BLU")
))
(if (equal? mrge #t) ( ;; to merge or not to merge
(gimp-layers-flatten InImage)
))
(gimp-image-undo-group-end InImage)
(gimp-display-flush)
)
)
(script-fu-register "script-fu-ScriptFails"
_"<Image>/Script-Fu/ScriptFails..."
"Runs but fails at the end. Why? Please help!"
"JK"
"(pop-zip,G-N-U)"
"2016.12"
"RGB*"
SF-IMAGE "The Image" 0
SF-DRAWABLE "The Layer" 0
;; other variables:
SF-OPTION "Effect" '("R_ed" "G_rn" "B_lu")
SF-TOGGLE "Merge Layers" FALSE
)