I'm using GIMP 2.10.2 and there is an option here for Colors>Desaturate>Color To Gray which works nicely by removing unnecessary gray shades from the photo.

However, I have about 200 photos which need to be processed this way, so I tried to use Python-Fu scripts to batch process multiple files. However, I can't seem to find this particular script to call this function.

There is GIMP-drawable-desaturate which doesn't really work too well. Does anyone know of a PDB script for the "Colors>Desaturate>Color To Gray"


  • If the GEGL code can not be scripted you may see if there is a GMIC-filter that meets your needs. GMIC filters are scriptable.
    – Takkat
    Commented Sep 7, 2018 at 7:39
  • You can also use Imagemagick for such an operation. Commented Sep 7, 2018 at 7:51
  • @xenoid Indeed, I've tested the function and works fine, but I'm unsure of the needs of Dave. I hope that API for GEGL tools will be available one day. Commented Sep 7, 2018 at 13:53
  • @PaoloGibellini Thanks for the tip, I took a look at Imagemagick, but I couldn't really find an equivalent to the "Color to Gray" tool. To expand on my needs, the photo is pages from a book with some texts and pictures on it which I want to print out, so I want to remove shadows, and highlight the text. I found the C2G the best for this. Unfortunately, it looks like it cannot be done at the moment, so I might have to do this manually for each picture
    – Dave
    Commented Sep 8, 2018 at 1:18
  • You can also use a script invoking GEGL command-line executable, chaining the available operations. You can find here an example of the use of GEGL with c2g option. I've performed a few quick test on Windows and sometimes I got a buffer error when the process was almost ended, resulting in some points unprocessed. I suggest you to give a look. Commented Sep 11, 2018 at 9:35

1 Answer 1


C2G is more than Color>Desaturate, it also does some form of grayscale HDR/tone-mapping, so the usual desaturation techniques are not a replacement.

Unfortunately, at the same time C2G is part of a set of "GEGL tools" for which there is currently no API in Gimp, so I don't think there is a way to code the equivalent of C2G in a script, until these tools have a matching scripting API.

  • Please add this information to your short answer to expand it. Then we can remove these comments. Commented Sep 7, 2018 at 15:45
  • GEGL provides a command-line executable, which can be used in scripts. Can you update your answer, please? Commented Sep 11, 2018 at 9:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.