我编写了一个GIMP脚本,如果我通过GIMP中的按钮打开它,它就会工作,但是如果我尝试以CLI模式(在Ubuntu上)启动它,它就不能工作。我尝试了以下命令:
gimp -c -i -d -b '(documentEnhancementProcedure 1 "raw.png" "test.png")' -b '(gimp-quit 0)'并获取错误:“参数2的无效类型到文件-png-load”.
因为脚本工作,所以当我从GIMP启动它时,我认为这是CLI命令的一个问题。
我试过:
全filepaths
我认为这很可能是个小错误,但我目前还无法发现.
提前感谢您的帮助!
剧本:
(define (documentEnhancementProcedure infile outfile)
(let*
(
(image (car (file-png-load 1 infile infile)))
(drawable (car (gimp-image-get-active-drawable image)))
(image-width (car (gimp-image-width image)))
(image-height (car (gimp-image-height image)))
)
;1. scale image by the factor 2
(gimp-image-scale image
(* image-width 2) (* image-height 2))
; (* image-width 2) New image width (1 <= new-width <= 524288)
; (* image-height 2) New image height (1 <= new-height <= 524288)
;2 apply sharpen-filter with given variables
(plug-in-unsharp-mask 1 image drawable
3 0.4 0)
; 3 Radius of gaussian blur (0 <= radius <= 300)
; 0.4 Strength of effect (0 <= amount <= 300)
; 0 Threshold (0 <= threshold <= 255)
;3.save image as png
(file-png-save2 1 image drawable outfile outfile
1 0 0 0 0 0 0 0 0 )
; 1 Adam7 interlacing?
; 0 deflate compression factor (0-9)
; 0 Write bKGD chunk?
; 0 Write gAMMA chunk?
; 0 Write oFFs chunk?
; 0 Write pHYS chunk?
; 0 Write tIME chunk?
; 0 Write comment?
; 0 Preserve color of transparent pixels?
)
)
(script-fu-register
"documentEnhancementProcedure" ; script name to register
"<Toolbox>/Xtns/Script-Fu/ownScripts/documentEnhancementProcedure" ; where it goes
"document gets doubeld in size\
and sharpened with following sharpen variables:\
radius 3\
amount 0.4\
threshold 0" ; script description
"" ; author
"Copyright 2021 by; GNU GPLv3" ; copyright
"23.09.2021" ; date
"" ; type of image
SF-FILENAME "Infile" "infile.png" ; default parameters
SF-FILENAME "Outfile" "outfile.png"
)发布于 2021-11-04 13:14:34
The comment by @xenoid worked:
尝试省略
RUN-MODE参数。顺便说一句,如果在批处理模式中使用脚本,则不需要注册脚本;2)可以使用ImageMagick的convert命令(参见-geometry和-sharpenargs)在一行中完成相同的操作。
https://stackoverflow.com/questions/69307734
复制相似问题