首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在gimp 2.0下,script-fu脚本不能加载图像

在gimp 2.0下,script-fu脚本不能加载图像
EN

Stack Overflow用户
提问于 2013-07-21 21:07:52
回答 1查看 1.1K关注 0票数 0

我试着用gimp 2.8编写这个脚本。

我在过程浏览器中看不到script-fu-register )。

我试着用RUN-INTERACTIVE和RUN-RUN INTERACTIVE来运行...此脚本:

代码语言:javascript
复制
 (define (script-fu-cut-height filename outputfilename myheight)
 (let* (
  (img (myimage (gimp-file-load RUN-INTERACTIVE filename filename)))
  (imagewidth (myimage (gimp-image-width img)))
  (imageheight (myimage (gimp-image-height img)))
  (width (- imagewidth (+ right left)))
  (height (- myheight (+ top bottom)))
  )
  (gimp-image-crop img width height left top)
  (gimp-png-save RUN-INTERACTIVE
    img
    (myimage (gimp-image-active-drawable img))
    outputfilename
    outputfilename)
 (gimp-image-delete img)
 ))

 (script-fu-register "script-fu-cut-height"
 "www.free-tutorials.org : script-fu"
 "Cut an image by height and let width default"
 "test"
 "www.free-tutorials.org"
 "Jul 2013"
 "RGB* GRAY*"
 SF-STRING "Filename" ""
 SF-STRING "OutputFilename" ""
 SF-VALUE "TopEdge" "0"
 SF-VALUE "RightEdge" "0"
 SF-VALUE "BottomEdge" "0"
 SF-VALUE "LeftEdge" "0"
 )
 script-fu-cut-height()

我使用下面的代码来运行它:

代码语言:javascript
复制
$ gimp -i -c -b "(script-fu-cut-height \"test-script-fu.png\" \"out-script-fu-output.png\" 85)" -b  "(gimp-quit 0)"

用户主文件夹中的图像。

我得到的错误是:

代码语言:javascript
复制
~$ gimp -i -c -b "(script-fu-cut-height \"test-script-fu.png\" \"out-script-fu-       output.png\" 85)" -b  "(gimp-quit 0)"
Fontconfig warning: "/etc/fonts/conf.d/65-droid-sans-fonts.conf", line 103: Having     multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "/etc/fonts/conf.d/65-droid-sans-fonts.conf", line 138: Having     multiple values in <test> isn't supported and may not work as expected
batch command experienced an execution error:
Error: (<unknown> : 136051114) eval: unbound variable: myimage 

Fontconfig warning: "/etc/fonts/conf.d/65-droid-sans-fonts.conf", line 103: Having multiple values in <test> isn't supported and may not work as expected
Fontconfig warning: "/etc/fonts/conf.d/65-droid-sans-fonts.conf", line 138: Having multiple         values in <test> isn't supported and may not work as expected
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2013-08-07 01:10:55

错误显示为“未绑定变量: myimage”。这告诉您,您正在引用一个名为"myimage“的变量/函数,但您从未定义过该变量,因此它不知道"myimage”代表什么。

你知道"myimage“应该代表什么吗?你是不是抄袭了别人的剧本?

函数gimp-file-load返回一个包含您打开的图像的列表。您需要使用"car“函数从该列表中提取第一个条目,以便将其存储在"img”变量中。所以不是(img (myimage (gimp-file-load RUN-INTERACTIVE filename filename ),而是(img (car (gimp-file-load RUN-INTERACTIVE filename filename)

此外,我认为您可能希望使用RUN-NONINTERACTIVE。

同样,我认为您将需要更改(my image ...)的其他实例。成为(汽车……)而不是。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/17772639

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档