Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Run batch command line in Fu console beginning with 'gimp'
#3
Thanks.

In the meantime I have figured it out: With the parameter --verbose I get the detailed output on the Gimp console - this works fine, however absolutely no errors are listed.

But attention:
This parameter can be placed only before the parameter -b! Otherwise it will proceed the script with vebose output but leads on the end to error:

Code:
Error: eval: unbound variable: --verbose

It seems to be a bug.
And abbreviations like -v or --v are not supported! Or more precisely -v does something completely different and indeed shows the versions of the Gimp modules without to process the rest of the code on the same command line.

However, I haven't found out yet how the command line is to be inserted directly in the Fu console, so that I can at least try it out there to see if it so finally starts up.

On the other hand via the GUI menu the both commands - "crop to content" (early "auto crop, before Gimp v.2.10) and "zealous crop" - works fine and the same pictures are processed without any problems.
 
A very strange thing.

Enclosed is a summary of everything - perhaps anyone will notice the error:

batch-crop-to-content.scm:
Code:
(define (batch-crop-to-content 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))))
    (plug-in-autocrop RUN-NONINTERACTIVE image drawable)
    (gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
    (gimp-image-delete image))
    (set! filelist (cdr filelist)))))

or analogously for batch zealous crop:
batch-zealous-crop.scm
Code:
(define (batch-zealous-crop 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))))
    (plug-in-zealouscrop RUN-NONINTERACTIVE image drawable)
    (gimp-file-save RUN-NONINTERACTIVE image drawable filename filename)
    (gimp-image-delete image))
    (set! filelist (cdr filelist)))))

And in batch script it is like:
Code:
@echo on
echo.
 
PushD %~dp0
 
set "gimp=%ProgramFiles%\GIMP 2\bin\gimp-2.10.exe"
 
"%gimp%" -i --verbose -b '(batch-crop-to-content "*.png")' -b '(gimp-quit 0)'
 
timeout /t 3 >nul

(resp. for zealous crop with adjusted line: '(batch-zealous-crop "*.png")' instead of '(batch-crop-to-content "*.png")')
 
And again: via batch script everything is executed without errors, but the *.png files (that are of course in the same directory of the batch scripts) are not processed but the same pictures are processed with the both commands via the GUI.
Reply


Messages In This Thread
RE: Run batch command line in Fu console beginning with 'gimp' - by Gimpnik - 09-24-2022, 05:31 AM

Forum Jump: