1

我从负片上拍了照片,我想批量反转颜色,我“不知何故”复制并粘贴了这样的脚本:

(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)))))

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

谢谢!

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

4

2 回答 2

1

gimp-levels-stretch解决,我为and加了太多参数gimp-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)))))
于 2010-11-10T14:17:28.883 回答
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)))))
于 2018-07-04T13:37:18.703 回答