2012-08-19 37 views
2

我收到以下錯誤:此方案/ script-fu/gimp代碼中的錯誤是什麼?

錯誤:無效的類型參數1至GIMP層一新

但儘可能接近我可以告訴大家,「形象」仍然是在範圍上,當我運行的功能,並且應該設置爲gimp-image-new的返回值,這是正確的類型。我想要的只是一個愚蠢的小動畫GIF,而且它正在讓我可以更快地手動完成這些操作。

(begin 
(let* 
     (
      (image (gimp-image-new 512 384 1)) 
      (counter 0) 
    ) 

     (while (< counter 30) 
      (let* 
       (
        (layer (gimp-layer-new image 512 384 2 (string-append (string-append "frame " (number->string counter)) " (33ms)") 100 0)) 
       ) 

       (gimp-image-add-layer image layer -1) 
       (plugin-in-rgb-noise 0 image layer 0 1 0.37 0) 
       (plugin-in-rgb-noise 0 image layer 0 1 0.37 0) 
       (gimp-brightness-contrast layer 0 -42) 
       (plugin-in-rgb-noise 0 image layer 0 1 0.37 0) 
       (plug-in-deinterlace 0 image layer 1) 
      ) 
      (set! counter (+ counter 1)) 
    ) 
     (gimp-display-new image) 
) 
) 

回答

2

試試這個:

(begin 
    (let* ((image (car (gimp-image-new 512 384 1))) ; here was the problem 
     (counter 0))  
    (while (< counter 30) 
      (let* ((layer 
        (gimp-layer-new 
        image 512 384 2 
        (string-append "frame " (number->string counter) " (33ms)") 
        100 0))) 
      (gimp-image-add-layer image layer -1) 
      (plugin-in-rgb-noise 0 image layer 0 1 0.37 0) 
      (plugin-in-rgb-noise 0 image layer 0 1 0.37 0) 
      (gimp-brightness-contrast layer 0 -42) 
      (plugin-in-rgb-noise 0 image layer 0 1 0.37 0) 
      (plug-in-deinterlace 0 image layer 1)) 
      (set! counter (+ counter 1))) 
    (gimp-display-new image))) 

我參加了正常縮進你的代碼,並簡化了string-append表達的自由,但在本質上的問題是,你必須要返回的值的cargimp-image-new,根據此page中的示例,第6部分。這將解決問題中報告的Error: Invalid type for argument 1 to gimp-layer-new

+1

謝謝奧斯卡獎。在嘗試之前,我可以說這是正確的答案,所以我將其設置爲已接受。我很感激幫助。 – 2012-08-19 16:49:55