Ric*_*ugh 6 gimp script-fu gimpfu
我想调整目录中每个 jpg 的大小。
这是我找到的 gimp 脚本。对我来说看起来很明智。
(define (batch-resize 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-active-drawable image)))
(cur-width (car (gimp-image-width image)))
(cur-height (car (gimp-image-height image)))
(width (* 0.25 cur-width))
(height (* 0.25 cur-height))
)
(gimp-message filename)
(gimp-image-scale-full image width height INTERPOLATION-CUBIC)
(let
((nfilename (string-append "thumb_" filename)))
(gimp-file-save RUN-NONINTERACTIVE image drawable nfilename nfilename)
)
(gimp-image-delete image)
)
(set! filelist (cdr filelist))
)
)
)
Run Code Online (Sandbox Code Playgroud)
我将其保存为C:\Users\rwb\.gimp-2.8\scripts\batch-resize.scm然后调用
"C:\Program Files\GIMP 2\bin\gimp-console-2.8.exe" -i -b '(batch-resize "*.JPG")' -b '(gimp-quit 0)'
输出是
>"C:\Program Files\GIMP 2\bin\gimp-console-2.8.exe" -i -b '(batch-resize "*.JPG")' -b '(gimp-quit 0)'
(gimp-console-2.8.exe:7568): LibGimpBase-WARNING **: gimp-console-2.8.exe: gimp_wire_read(): error
batch command executed successfully
batch command executed successfully
Run Code Online (Sandbox Code Playgroud)
此时它就挂起了。
我期待(gimp-message filename)打印文件名,但什么也没有!
我真的不知道这是怎么回事!您能提供一些建议吗?甚至打印文件名也是一个开始。
问题源于您引用命令行的方式。这应该有效:
"c:\Program Files\GIMP 2\bin\gimp-console-2.10.exe" -b "(batch-resize \"*.JPG\")" -b "(gimp-quit 0)"
Run Code Online (Sandbox Code Playgroud)
请注意,它已针对 GIMP 2.10 进行更新。此外,用户脚本文件现在位于:
c:\Users\rwb\AppData\Roaming\GIMP\2.10\scripts
Run Code Online (Sandbox Code Playgroud)
最后,您问题中的代码块的格式是在块外加上最后一个括号,这使得很容易错过。我已经更新了。
| 归档时间: |
|
| 查看次数: |
7518 次 |
| 最近记录: |