2

我收到以下错误:

错误:gimp-layer-new 的参数 1 的类型无效

但据我所知,当我运行该函数时,“图像”仍在范围内,并且应该设置为 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)
 )
)
4

1 回答 1

3

试试这个:

(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表达式,但本质上问题是您必须根据本页第 6 节中的示例获取car返回的值的。这将解决报告中的问题。gimp-image-newError: Invalid type for argument 1 to gimp-layer-new

于 2012-08-19T14:59:39.893 回答