Consider the following problem: Multiple images should be modified with the Cartoon filter. Therefor the following script my-test.scm is copied to gimp's Script path:

(define (my-test filename exportfilename radius amount threshold)
     (let* (   
               ; Loading the image and get the active layer for processing 
               (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename)))
               (drawable (car (gimp-image-get-active-layer image)))
          (plug-in-cartoon RUN-NONINTERACTIVE image drawable 7.0 0.97) ; seems to call the legacy plugin, as the effect is not the same unless one selects the "Cartoon (Legacy)" Option in the GUI
          (gimp-file-save RUN-NONINTERACTIVE image drawable exportfilename exportfilename)
          (gimp-image-delete image)

When executing the script via

gimp -i -b '(my-test "<FILEPATH>.png" "processed.png" 5.0 0.5 0)' -b '(gimp-quit 0)'

the output file does appear to have the filter applied. However, the result is different from what is obtained when doing the same process from the GUI. My first investigation seems to indicate that running plug-in-cartoon in a script links to Cartoon (Legacy) instead of Cartoon.


Is there a way to reconfigure which plugin is called?

Information for Reproduction

  • Problems observed with GIMP 2.10.34, Linux (probably might be reproducible with any version since 2.X and operating system)
  • my-test.scm copied to GIMP Script Directory
  • Execution of
gimp -i -b '(my-test "<FILEPATH>.png" "processed.png" 5.0 0.5 0)' -b '(gimp-quit 0)'

2 Answers 2


You don't "reconfigure". The new plugin is a GEGL plugin, so you call it as a GEGL plugin, which is very contrived.

On the other hand, since it is a GEGL plugin you can also call the GEGL operation on the command line. If this is the only thing you do, you can bypass Gimp entirely, and if you need other Gimp operations, you can export to a temp file, run the GEGL filter from Python (subprocess.popen() or else), reload the result and continue from there.


Based upon the suggestions by @xenoid I wrote the following Python Snippet:

import sys, subprocess

GEGL_SHELL_EXECUTE_CARTOON_TEMPLATE = "gegl -o {exportPath} {importPath} -- cartoon mask-radius={maskRadius} pct-black={percentBlack}"

def apply_gegl_cartoon(importPath : str, exportPath : str, maskRadius : float, percentBlack : float) -> None:
        exportPath = exportPath, importPath = importPath, maskRadius = maskRadius, percentBlack = percentBlack
    sys.exit(subprocess.call(_tmp_shcode, shell=True))

This will be integrated into a larger Python Script containing other image processing with PIL, OpenCV etc..

However, it is important to note that this approach does NOT use/provide any functionality the gimpfu package might have. This limits the solution as posted here to only certain use cases.

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.