Script-fu help?
Quoting William Fishburne :
I'm processing text images for Project Gutenberg (www.gutenberg.net)
and I'd like to have a script-fu script that would take a list of files
(preferably a file glob) and do the following:
* read in the file (a png file that is RGB)
* Desaturate HSV
* Merge the layers of the desaturated image
* Save the file to a new directory, but with the same name
Download the script from
http://flashingtwelve.brickfilms.com/GIMP/Scripts/batch-grayscale.scm
and place it in your "~/.gimp-2.2/scripts/" directory (or other
appropriate location). You should then be able to call the function
from a shell using a command similar to the following:
gimp --no-data --no-interface -b '(batch-grayscale-image
"filename1.png /home/saul/images/*.png books/covers/Twain*.png"
"/home/saul/GrayscaleVersions/" 0)' '(gimp-quit 0)'
The first parameter to the function 'batch-grayscale-image' is a
file-glob string and can be a list of discrete filenames, a wildcard
expression, or a combination of both. The second parameter is a
directory name string (it does not matter if the trailing slash is
present or not) and this directory must already exist. The third and
final parameter is the "method" to be employed to effect the
conversion. It is a number ("0", "1", or "2") and has the following
meaning:
0 = Value: the same result as the "Value" channel of an
HSV decompose
1 = Channel mixer: the same result as changing the image mode to Grayscale
2 = Desaturate: the same result as performing a desaturate on the layer
For what it's worth, the script is not limited to PNG files; but if
other types are used, only the top layer is converted to grayscale, no
merging of multiple layers takes place, and the output file is of the
same type.
If you encounter any difficulties or require further customization of
the script, feel free to let me know and I will be more than happy to
do what I can to assist (I am a great fan of Project Gutenberg).
Hopefully, you are not using Windows as I have experienced some
difficulty with Windows using my scripts from the command line (mostly
due to their peculiar employment of the backslash).