一个简单的gimp脚本的问题

时间:2010-11-10 14:01:35

标签: gimp

我从我的负片中拍摄了照片,我希望批量反转颜色,我“以某种方式”复制并粘贴这样的脚本:

(define (batch-negative pattern)
  (let* ((filelist (cadr (file-glob pattern 1))))
    (while (not (null? filelist))
           (let* ((filename (car filelist))
                  (image (car (gimp-file-load RUN-NONINTERACTIVE
                                              filename filename)))
                  (drawable (car (gimp-image-get-active-layer image))))
             (gimp-invert RUN-NONINTERACTIVE
                                   image drawable)
             (gimp-levels-stretch RUN-NONINTERACTIVE
                                   image drawable)
             (gimp-file-save RUN-NONINTERACTIVE
                             image drawable filename filename)
             (gimp-image-delete image))
           (set! filelist (cdr filelist)))))

我尝试按照教程进行操作,但是失败了,我认为gimp-invert的行有问题,但我不知道在哪里,有人可以帮忙吗?

谢谢!

编辑:仅供参考,我正在使用ubuntu 10.10,再次感谢

2 个答案:

答案 0 :(得分:1)

求解,我为gimp-levels-stretchgimp-invert添加了太多参数,修改后的代码如下:

(define (batch-negative pattern)
  (let* ((filelist (cadr (file-glob pattern 1))))
    (while (not (null? filelist))
           (let* ((filename (car filelist))
                  (image (car (gimp-file-load RUN-NONINTERACTIVE
                                              filename filename)))
                  (drawable (car (gimp-image-get-active-layer image))))
             (gimp-invert RUN-NONINTERACTIVE
                                   image drawable)
             (gimp-levels-stretch RUN-NONINTERACTIVE
                                   image drawable)
             (gimp-file-save RUN-NONINTERACTIVE
                             image drawable filename filename)
             (gimp-image-delete image))
           (set! filelist (cdr filelist)))))

答案 1 :(得分:1)

当我浏览相同的问题时,我找到了答案...但是您再次在答案中使用了完全相同的脚本;) 所以这是固定的,删除了2个参数,效果很好:

(define (batch-negative pattern)
  (let* ((filelist (cadr (file-glob pattern 1))))
    (while (not (null? filelist))
           (let* ((filename (car filelist))
                  (image (car (gimp-file-load RUN-NONINTERACTIVE
                                              filename filename)))
                  (drawable (car (gimp-image-get-active-layer image))))
             (gimp-invert drawable)
             (gimp-levels-stretch drawable)
             (gimp-file-save RUN-NONINTERACTIVE
                             image drawable filename filename)
             (gimp-image-delete image))
           (set! filelist (cdr filelist)))))