GIMP Scripting for the beginner

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)
(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)
"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."
"copyright 2007, LCRM"
"July 12, 2007"
SF-STRING    "Filename"    "Filename"


Post a comment

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.