This is a modified version of the script at http://registry.gimp.org/node/22018 which allows you to run it from the command line, automatically merging the layers and saving to the same filename. I also created a simple batch wrapper around this, based on the code at http://www.gimp.org/tutorials/Basic_Batch/ and sliced and diced it appropriately.
[Taken from the original script page, hope they don't mind!]
I can't take any credit at all for the original script (that goes to Bernhard Stockmann for the original technique at http://www.gimpusers.com/tutorials/making-a-pencil-drawing-from-a-photo and Mr-L at the above script) but after much head-scratching as to how to automate this into a batch processor, and finding nothing else that would do the job, I wanted to share it to save other people the pain I went through!
do-pencil-drawing basic syntax:
do-pencil-drawing filename sfBlurRadius sfStrength
(File name, Blur radius, times to repeat for strength)
batch-pencil-drawing basic syntax:
batch-pencil-drawing pattern blurradius strength
(Filename pattern to glob, blur radius, times to repeat for strength) - wraps around do-pencil-drawing
Single file command line usage (assuming GIMP is in your path, in Windows, add "C:\Program Files\GIMP-2.0\bin" to the end of your path, e.g. SET PATH=%PATH%;C:\Program Files\GIMP-2.0\bin before you start):
Win32: gimp-2.6 -i -b "(do-pencil-drawing \"c:\\path\\to\\file\\filename.jpg\" 2 2)" -b "(gimp-quit 0)"
Linux etc: gimp -i -b "(do-pencil-drawing \"/path/to/file/filename.jpg\" 2 2)" -b "(gimp-quit 0)"
Batch file command line example usage (to do all .jpg files in the path):
Win32: gimp-2.6 -i -b "(batch-pencil-drawing \"c:\\path\\to\\files\\*.jpg\" 2 2)" -b "(gimp-quit 0)"
Linux etc: gimp -i -b "(batch-pencil-drawing \"/path/to/files/*.jpg\" 2 2)" -b "(gimp-quit 0)"
Tested on GIMP 2.6 (and above command lines for Win32 refer to the GIMP 2.6 binaries), assumed to work on 2.4 as the original script was tested on there, if anyone is still using 2.4, please do comment and verify.