最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How to interate about files by batch processing in GIMP 3.X? - Stack Overflow

programmeradmin0浏览0评论

see the following script. It works with GIMP 2.10 but doesn't witch GIMP 3.X.

(
    define (brightness-contrast-multi pattern brightness contrast) (
        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-image-convert-grayscale image)
                (gimp-drawable-brightness-contrast drawable brightness contrast)
                (gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
                (gimp-image-delete image)
            )
            (set! filelist (cdr filelist))
        )
    )
)

I tried to run this script by the following command:

gimp -i --batch-interpreter=plug-in-script-fu-eval -b '(brightness-contrast-multi "*.png" 0 0.75)' -b '(gimp-quit 0)'

and get the error message:

(script-fu:13349): scriptfu-WARNING **: 16:23:40.849: Calling Plug-In PDB procedures with arguments as an ordered list is deprecated. Please use named arguments: (file-glob #:pattern ".png" #:filename-encoding TRUE) batch command experienced an execution error: Error: car: argument 1 must be: pair Stopping at failing batch command [0]: (brightness-contrast-multi ".png" 0 0.75)

So, I changed the script to:

(
    define (brightness-contrast-multi pattern brightness contrast) (
        let* (
            (filelist (cdr (file-glob #:pattern pattern #:filename-encoding TRUE)))
        )
        (
            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-image-convert-grayscale image)
                (gimp-drawable-brightness-contrast drawable brightness contrast)
                (gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
                (gimp-image-delete image)
            )
            (set! filelist (cdr filelist))
        )
    )
)

But now, filelist ist null ...

What I am doing wrong? Thanks!

发布评论

评论列表(0)

  1. 暂无评论