这个scheme / script-fu / gimp代码中的错误是什么?

时间:2012-08-19 05:28:11

标签: scheme gimp script-fu

我收到以下错误:

错误:参数1到gimp-layer-new

的类型无效

但是我尽可能地说,当我运行该函数时,“image”仍然在范围内,并且应该设置为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)
 )
)

1 个答案:

答案 0 :(得分: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表达式,但实质上问题是你必须取car返回的值的gimp-image-new,根据此page第6节中的示例。这将解决问题中报告的Error: Invalid type for argument 1 to gimp-layer-new