Site Map

Thoughts and ideas about things that I find interesting 

Facebook Twitter YouTube E-mail RSS
formats

Executing Gimp Scripts from the Command Line on Windows

Here’s a step by step demonstration of how to use a Gimp script to process images from the command line on Windows.

Firstly, here’s a very simple example script that takes one image, applies the illusion effect to it and then saves it as a new image:

example-script.scm

(
   define (example-script inputFilename outputFileName)
   (
      let* (
         (image (car (gimp-file-load RUN-NONINTERACTIVE inputFilename inputFilename)))
         (drawable (car (gimp-image-get-active-layer image)))
      )
      (plug-in-illusion RUN-NONINTERACTIVE image drawable 10 0)
      (gimp-file-save RUN-NONINTERACTIVE image drawable outputFileName outputFileName)
   )
)

Next, copy the script to your Gimp’s scripts directory. On my machine this is at C:”Program Files (x86)”GIMP-2.0sharegimp2.0scripts

You’ll also want to add Gimp’s bin directory to your Path environment variable:

If you’ve already got a console window open then you’ll need to close and reopen one for the addition to the Path variable to take effect.

Now, choose an image to test your script on…

input.jpg

Next, run your script!…

gimp-console-2.6.exe –verbose -i -b “(example-script “input.jpg” “output.jpg”)” -b “(gimp-quit 0)”

(Note the escaping of quotes!)

If all went well, an output image will be generated:

output.jpg

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Home Technology Software Development Data Visualisation Executing Gimp Scripts from the Command Line on Windows