2013-01-10 24 views
0

以下是我正在嘗試編寫的較大的Script-fu腳本的一部分。Script-fu複製後無法縮放圖像

我遇到了一個問題,試圖複製打開的.xcf文件,然後將其縮放到某個用戶指定的維度。

以下是我雖然會工作內容:

(define (my-duplicate-and-scale inImage inDrawable inWidth inHeight) 
    (let* ((theDuplicateImage (gimp-image-duplicate inImage))) 

     (gimp-image-scale theDuplicateImage inWidth inHeight) 
    ) 
) 

(script-fu-register 
    "my-duplicate-and-scale" ;func name 
    "Duplicate and Scale ..." ;menu label 
    ""       ;description 
    ""       ;author 
    ""       ;copyright notice 
    ""       ;date created 
    "*"      ;image type that the script works on 
    SF-IMAGE "Image" 0 
    SF-DRAWABLE "Drawable" 0 
    SF-VALUE "Width" "512" 
    SF-VALUE "Height" "512" 
) 

(script-fu-menu-register "my-duplicate-and-scale" "<Image>/File/My") 

當我執行我收到以下錯誤功能:

Error while executing my-duplicate-and-scale: 

Error: (: 2) Invalid type for argument 1 to gimp-image-scale 

按程序瀏覽器gimp-image-duplicate返回IMAGE和第一參數到gimp-image-scaleIMAGE

+0

如果您尚未與方案中使用,也許是更好的交易將是學習Python的腳本:這是一種更爲靈活的語言,但沒有很多捕捉計劃。 – jsbueno

回答

1

試試這個代碼:

替換:

(let* ((theDuplicateImage (gimp-image-duplicate inImage))) 

有:

(let* ((theDuplicateImage (car (gimp-image-duplicate inImage)))) 
+0

你的答案幫我弄清楚我做錯了什麼。實際返回的是一個列表。該列表有一個項目,一個圖像。即「(IMAGE)」而不是「IMAGE」。謝謝 – mmorris