Results 1 to 3 of 3

Thread: How to do batch processing in GIMP for Windows

  1. #1

    Default How to do batch processing in GIMP for Windows

    Gimp is now up to version 2.4.4. Get it.

    Here's a short "monkey-see monkey-do" tutorial on how to do batch processing for GIMP 2.4.4 on Windows XP.

    First you download and install Gimp 2.4.4 from

    Next you download a script-fu which you like - eg smart-sharpen2.scm from

    You put the script into the scripts folder - typically C:\Program Files\Gimp-2.0\share\gimp\2.0\scripts in a Windows XP installation.

    Then you create a script to batch process that script:

    ; Template for batch processing script

    (define (batch-run 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))))

    (script-fu-smart-sharpen2 image drawable)

    (gimp-image-flatten image)
    (set! drawable (car (gimp-image-get-active-layer image)))

    ; save the image
    (gimp-file-save 1 image drawable filename filename)
    (gimp-image-delete image))
    (set! filelist (cdr filelist))))

    (script-fu-register "batch-run"
    "Template for batch processing script"
    SF-IMAGE "Image" 0
    SF-DRAWABLE "Layer to process" 0)
    ; End script
    You can cut and paste the above and put it into a text file named "batch-run.scm". Put this file into the scripts folder as well. In this example, it will run the smart-sharpen2 script. YOU CAN SUBSTITUTE ANY SERIES OF SCRIPTS, PLUG-INS OR ACTION BY INSERTING IT INTO THIS SCRIPT. Eg you can change "(script-fu-smart-sharpen2 image drawable)" into "(gimp-desaturate drawable)" to make it turn the image into B&W instead. Or you can do both by ADDING "(gimp-desaturate drawable)" below "(script-fu-smart-sharpen2 image drawable)".

    You can find the full list of procedures available (and their parameters) by starting up Gimp and going to Xtns > Procedure Browser. Note that whether it's a script-fu, plug-in or procedure, it needs to be enclosed in brackets with the correct number of parameters. This is important, because the batch processor uses LISP programming language.

    The final step is to simply cut and paste the below into a text file and naming it run-batch.bat (or any other name, as long as it ends in .bat, which is a Windows batch file):

    @echo off
    cd\Program Files\GIMP-2.0\bin
    gimp-2.4 -i -b "(batch-run \"C:\\batch\\*.jpg\") (gimp-quit 0)"
    If you like to see what's going on rather than staring at a blank screen, you can remove the "-i" parameter.

    Create a folder named "batch" on your C: drive and copy the files you want to process into that folder. (ie in C:\batch\).

    Now double-click the batch file you have created and all the files in C:\batch will be processed according to the scripts or procedures you have defined. Note that this will only work with jpg files. If you have different formats, just change the jpg in the batch file to the format you're using. Gimp should be able to handle it.

    You can of course choose to create a folder by a different name - you just have to rename the folder in the Windows batch file as well.

    Hope this is helpful! Just follow step by step. It looks intimidating, but it's actually quite simple. And once you get the hang of it, the sky's the limit!
    Last edited by StreetShooter; 5th February 2008 at 11:01 PM.

  2. #2

    Default Re: How to do batch processing in GIMP for Windows

    Wow. Thanks. I am still clueless about script-fu... I will try it someday. If I have any questions, I will post it here.

  3. #3

    Default Re: How to do batch processing in GIMP for Windows

    Thanks, I am a new Gimp user. Hope to see more tips here.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts