Sample 1 this for use in Gimp --> save to test.scm
(define (script-fu-Test_scrip image drawable)
(
(plug-in-autocrop RUN-NONINTERACTIVE image drawable)
(gimp-displays-flush)
(gimp-file-save RUN-NONINTERACTIVE image
drawable filename filename)
)
)
(script-fu-register "script-fu-Test_scrip"
_"Add Test_scrip"
_"Add Test_scrip123"
"Prapop Puapermpoonsiri<prapopp@hotmail.com>"
"Prapop Puapermpoonsiri
"2022/06/66"
"RGB*"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
)
(script-fu-menu-register "script-fu-Test_scrip" "<Image>/Filters/Decor")
(
(plug-in-autocrop RUN-NONINTERACTIVE image drawable)
(gimp-displays-flush)
(gimp-file-save RUN-NONINTERACTIVE image
drawable filename filename)
)
)
(script-fu-register "script-fu-Test_scrip"
_"Add Test_scrip"
_"Add Test_scrip123"
"Prapop Puapermpoonsiri<prapopp@hotmail.com>"
"Prapop Puapermpoonsiri
"2022/06/66"
"RGB*"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
)
(script-fu-menu-register "script-fu-Test_scrip" "<Image>/Filters/Decor")
**** need to refresh script-fu in toobar filter
Sample2 for batch command-->
batch-autocrop.scm
(define (batch-autocrop 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)))))
- Copy the
batch-autocrop.scminto the scripts folder
Where do Gimp scripts and plugin live? It’s easy to find out. Open Gimp and within the top menu bar select Edit\Preferences\Folders,
expand Folders out and Select “Scripts”. It is recommended to put your
personal scripts into your configuration folder as circled in red below.
- Within a terminal change into the directory of images you want to crop and run the script
gimp -i -b '(batch-autocrop "*.PNG")' -b '(gimp-quit 0)' <---linuxsample2 Cr. Joe Lotz and Greg Hildströmhttps://www.joelotz.com/blog/2020/batch-autocrop-png-images-in-gimp.htmlI addition :command on windowsC:\Me\12>gimp-2.10 -b "(batch-autocrop \"*.JPG\")" -b "(gimp-quit 0)"Cr. for fix Sam Kupera and saulgoode@flashingtwelve.brickfilms.com
https://www.gimpusers.com/forums/gimp-user/3587-trouble-calling-running-batch-script-in-windows-xp#message14390