2013-07-21 60 views
0

我嘗試使用gimp 2.8來編寫腳本。script-fu腳本無法在gimp 2.0下載入圖像

我在程序瀏覽器中看不到script-fu-register)。

我嘗試用RUN-INTERACTIVE和運行非交互...這個腳本運行:

(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() 

我用它來運行它:

$ gimp -i -c -b "(script-fu-cut-height \"test-script-fu.png\" \"out-script-fu-output.png\" 85)" -b "(gimp-quit 0)" 

這是對用戶的主文件夾的圖像。

錯誤我:

~$ 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 
+0

標題帖子有誤我用gimp 2.8,對這個小錯誤抱歉。 –

回答

1

錯誤說 「未綁定變量:MYIMAGE」。這是告訴你,你指的是一個稱爲「myimage」的變量/函數,但是你從來沒有定義這個變量,所以它不知道「myimage」代表了什麼。

你知道什麼「myimage」應該代表什麼?你是否從另一個人的劇本中複製了這些內容?

函數gimp-file-load將返回一個包含您打開的圖像的列表。您需要使用「car」功能從該列表中提取第一個條目,以便它可以存儲在「img」變量中。因此,而不是 (IMG(MYIMAGE(GIMP文件加載運行交互式的文件名的文件名))) 應該說 (IMG(汽車(GIMP文件加載運行交互式的文件名文件名)))

而且,我想你可能想使用RUN-NONINTERACTIVE。

同樣的,我想你會需要改變的 相互實例(我的圖片) 是 (車...) 代替。

+0

謝謝,我也修正了汽車功能,但我得到了這個: script-fu-register:參數類型必須是整數值batch command遇到執行錯誤: 錯誤:(:161757610)eval:未綁定變量:正確 ...我需要更多關於汽車的信息以及如何解決這個問題 –