Re: [Gimp-user] batch mode in gimp?



On 08/01/2013 04:10 PM, Josef Wolf wrote:
Hello,

I am trying to use gimp in batch mode. Unfortunately, I can't find any
examples of how to do _real_ batch processing. All the examples on the
net show how to integrate into the gui.

I see that I can use the -b flag to invoke script-fu functions. But AFAICS,
the script with the function definitions needs to reside somewhere in
~/gimp-x.y/scripts or something.

In addition, I can't find a way to pass command line arguments to the called
functions.

Is there any way to define/execute functions? For example, I'd like to call
simple-unsharp-mask from http://www.gimp.org/tutorials/Basic_Batch/ like this:

  $ call-gimp-function script.scm simple-unsharp-mask file.png 5.0 0.5 0

Is there any way to achieve this? Any hints?


For such simple processing, you should consider using ImageMagick. Here my script that, for all the files in the directory:
- boosts the saturation a bit
- reduces the files to 3000px wide
- sharpens a bit
- saves with quality 85
--------------------------------
#! /bin/bash

dir=${1:-.}

for f in "$dir/"*.JPG;
do
    echo "Exporting $f"
convert "$f" -modulate 100,120 -geometry 3000 -sharpen 0x1.0 -quality 85 "$dir/$(basename "$f" .JPG).jpg"
done
--------------------------------

Runs in about 5 seconds/file (on 12Mpx source files) on my PC (Core i5-3320M CPU @ 2.60GHz, Ubuntu AMD64)

If you insist in using Gimp for this, PM me and I'll send you a sample batch script (uses Python) with sample command lines for Linux and Windows

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]