RSS/Atom feed Twitter
Site is read-only, email is disabled

Script-fu help?

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

3 of 3 messages available
Toggle history

Please log in to manage your subscriptions.

Script-fu help? William Fishburne 05 Aug 00:24
  Script-fu help? GSR - FR 05 Aug 00:53
  Script-fu help? saulgoode@brickfilms.com 05 Aug 06:31
William Fishburne
2006-08-05 00:24:44 UTC (almost 18 years ago)

Script-fu help?

Hi,

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

This should be simple, but I can't get the hang of script-fu (my lisp is terribly rusty). I can't even find the right commands. Can some kind soul help me?

I'm assuming this could be done non-interactively and that I'd just have to pass the script the file glob and the name of the new directory.

Thank you so very much,

William Fishburne

GSR - FR
2006-08-05 00:53:49 UTC (almost 18 years ago)

Script-fu help?

Hi,
william.fishburne@verizon.net (2006-08-04 at 1824.44 -0400):

* 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

Which png have layers?

In any case, you could look at plain shell and imagemagick like in http://www.cit.gu.edu.au/~anthony/graphics/imagick6/color/ (modulate or fx ones, for example).

GSR

saulgoode@brickfilms.com
2006-08-05 06:31:35 UTC (almost 18 years ago)

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).