gpt4 book ai didi

ubuntu - 为什么 GIMP 脚本在 CLI 模式下不起作用?

转载 作者:行者123 更新时间:2023-12-04 19:27:54 25 4
gpt4 key购买 nike

我编写了一个 GIMP 脚本,如果我通过 GIMP-GUI 中的按钮打开它,它就可以工作,但如果我尝试在 CLI 模式下(在 Ubuntu 上)启动它,它就不起作用。
我尝试了以下命令:

 gimp -c -i -d -b '(documentEnhancementProcedure 1 "raw.png" "test.png")' -b '(gimp-quit 0)'
并获取 错误:“file-png-load 的参数 2 的类型无效”。
由于脚本有效,当我从 GIMP-GUI 启动它时,我认为这是 CLI 命令的问题。
我努力了:
  • 完整文件路径
  • 转义字符

  • 我认为这可能是一个小错误,但我目前无法发现它......
    预先感谢您的帮助!
    剧本:
    (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"
    )

    最佳答案

    The comment@xenoid工作:

    Try omitting the RUN-MODE argument. Btw, 1) you don't need to register the script if you use it in batch mode, and 2) you can do the very same thing in one line using ImageMagick's convert command (see -geometry and -sharpen args).

    关于ubuntu - 为什么 GIMP 脚本在 CLI 模式下不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69307734/

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