GIMP: first script-fu

GIMP is great tool for images manipulation. Even better is to automate as much as possible through scripts.
Lets say we would create file named my-first.scm and this file will be placed into sub-directory scripts. Location would depend on the operation system.
Here is example from Windows 10:
C:\Users\JoeDoe\AppData\Roaming\GIMP\2.10\scripts\my-first.scm

File could have content:

(define (ten) (+ 5 5))
(define (square x) (* x x))

In GIMP, scripts have to be refreshed: Filters/Scripts-Fu/Refresh scripts
Then we can open console Filters/Script-Fu/Console and in command line write command:
(ten)
We should see output 10.
(square 5)
We should see output 25.

At https://stackoverflow.com/questions/5811378/how-do-i-write-a-custom-auto-crop-script-using-the-gimp has been published very useful Edger Script. If you would copy and paste it into file, let’s say C:\Users\JoeDoe\AppData\Roaming\GIMP\2.10\scripts\my-edger.scm and then refresh scripts. Script takes arguments input-file, output file, top, right, bottom, left. Example executing it from the console is below:

(script-fu-wirebear-edger "I:\\Pictures\\IMG-000.png" "I:\\Pictures\\Edged-IMG-000.png" 10 20 30 40)
This entry was posted in workday. Bookmark the permalink.

Leave a Reply