【问题标题】:Compare image width to number fails将图像宽度与数字进行比较失败
【发布时间】:2016-12-05 08:42:24
【问题描述】:

此脚本在 if 语句处失败,并显示“错误:(:1)>:参数 2 必须为:数字”,为什么?

(define x 1500)

(if(> x (gimp-image-width image))
(set! x (gimp-image-width image))
)

对于 GIMP 中使用的 Scheme 版本有什么好的参考吗?

【问题讨论】:

    标签: scheme gimp script-fu


    【解决方案1】:

    当您在 script-fu 控制台中尝试时,gimp-image-width 返回一个列表而不是数字:

    (gimp-image-width 1)
    (400)
    

    所以你必须提取列表的元素:

    (define x 1500)
    (if(> x (car (gimp-image-width 1)))
    (set! x (gimp-image-width 1))
    )
    

    附带说明,如果您开始编写 Gimp 脚本,使用 Python 会容易得多:

    width=min(1500,image.width)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-11-01
      • 2014-05-15
      • 2015-04-13
      • 1970-01-01
      • 1970-01-01
      • 2018-06-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多