Well, it took me approximately three full days of trying and testing, using the Script-Fu console mainly, but I am happy to report that I now understand the way to use the GIMP command line.
I will try to report on my finding, some solutions and assist with future use of GIMP in the best way I can here in this blog.
A script has also surfaced that presents the results of my hard work. (Covered later)
Some of the problems I encountered when tackling this subject for the first time were:
- understanding the parenthesis syntax
- using and ssigning variables and their values
However for now I will just attach the script, which should be saved into ~/.gimp**/scripts/
Once done open gimp and Xtns/Script-Fu/Refresh Scripts…..hopefully no errors and you can access it by the toolbox menu Xtns > Script-Fu/Misc/Levels.
Please bear with me as i am writing this in a hurry and will amend it when i get a minute.
(define (Levels filename)
(let*
(
(image (car (gimp-file-load 1 filename filename)))
(drawable (car (gimp-image-get-active-drawable image)))
(display (car (gimp-display-new image)))
)
(gimp-image-rotate image 0)
(gimp-levels-stretch drawable)
(gimp-file-save-thumbnail image filename)
(file-tiff-save 1 image drawable filename filename 4)
(gimp-display-delete display)
)
)
(script-fu-register
"Levels"
"\<Toolbox\>/Xtns/Script-Fu/Misc/Levels"
"Opens the file, passed as a parameter STRING, \
auto-levels and then saves the file. \
Also saves a nice thumbnail of the image. \
N.B. overwrites previous image."
"LCRM"
"copyright 2007, LCRM"
"July 12, 2007"
""
SF-STRING "Filename" "Filename"
)