Integrate G'mic as a menu in Gimp ?


Hello all,

I saw once a screenshot of Gimp from someone on this forum i believe, can’t put my hands on it anymore but in this screenshot we could see G’mic being part of the Gimp menus, not located at the bottom of the filters list from Gimp.

made a quick montage to show what i am talking about, I’m wondering how to achieve this :

I know we can customize .scm scripts and create a new menu using something like this at the end of the script :

(script-fu-menu-register "Some_Script" _"<Image>/Custom Menu")

I don’t know much about script-fu stuff, using a few ones and knowing how to edit them to place them where i want in the filter list of Gimp or create a custom menu to have all them grouped together there but that’s pretty much all i know sadly.

So i’m wondering if it is possible to create a script launching Gmic directly that could be then customized a bit like in the code above :
(script-fu-menu-register "G'mic" _"<Image>/Custom Menu")

Also found this with a few parameters but not had time to dig into this much for now :

The “run-mode interactive” option leads me to think it might be possible to simply launch G’mic with the UI from some kind of Scrip-fu, well… not sure at all about this.

Maybe there is even more simple solutions that i am not aware of,
or maybe this could be a setting inside Gmic itself who knows , i mean one of the files that could be edited to place it there instead of being at the bottom of the filters list ( tried to search in the files i could open in notepad++ but saw nothing like this )

If anyone have a few tips or ideas about where i should look to achieve this please it will be greatly appreciated :slight_smile:

Thanks a lot.

(paul matthijsse) #2

Can’t help you with the menus, but I made a shortcut in Gimp to start G’mic: Ctrl+Shift+G is all I need.

(MareroQ) #3

Hi Yalba.

Not script-fu just a simple Python plug-ins. (650 bajtów)

#!/usr/bin/env python
#-*- coding: utf-8 -*-
# based on the idea "Gimpscripter"

def plugin_main(image, drawable):

  pdb.plug_in_gmic_qt( image, drawable, 0, 0, 0, run_mode=RUN_INTERACTIVE)
if __name__ == "__main__": 
  from gimpfu import *    
    "Shortcut to favourite plugins",
    "This plugin was created using 'GimpScripter...",
    "Bootchk - modified MareroQ",
    "<Image>/G'MIC/G'MIC QT...", 
    "RGB*, GRAY*", 


Thanks a lot to both of you,

I was trying to figure this out by myself and was stuck in my script-fu attempt since few days but your python script helped me to find out what was wrong on mine, thank you very much.

The python one works nicely, thanks a lot for this ( and i will have to check the gimpscripter link, might serve in the future too :slight_smile: )

Here is my script-fu version :

;; Gmic_In_Main_Menu.scm
;; Simple script to integrate a shortcut calling G'mic-QT on the main menu of Gimp.
;; Seems like it needs to be clicked twice to be triggered tho.
;; Based on the example found here :
;; By Yalba @ forum - December 2018.

(define   (Gmic_In_Main_Menu image drawable)

  ;; Start undo group.
  (gimp-image-undo-group-start image)

  (let* (
         (copy-layer (car (gimp-layer-copy drawable TRUE)))

    (plug-in-gmic-qt 0 image drawable 1 2 "")


  ;; Flush display.

  ;; End undo group.
  (gimp-image-undo-group-end image)

(script-fu-register "Gmic_In_Main_Menu"
                    "Shortcut to call G'MIC from Gimp main menu...  
     ! Might need to be clicked twice to trigger it... ! "
                    "Yalba @ Forum"
                    "Yalba @ Forum"
                    "December 2018"
                    SF-IMAGE    "Image"     0
                    SF-DRAWABLE "Drawable"  0

Seems like it does the job, this said placed like this directly on the main menu it needs to be clicked twice to be triggered, if placed on a submenu like in your python script it works directly, not sure why, same thing happens if i modify the python script :

"<Image>/G'MIC/G'MIC QT...",

"<Image>/G'MIC QT...",
Modified like this it will need 2 clicks to launch Gmic. :thinking:

Anyways it’s good enough like this for both the python or script-fu, result :

Now that i figured out this i might create in the future a few more script-fu scripts executing directly some of the gmic commands i use the most :stuck_out_tongue:

Script to put in AppData\Roaming\GIMP\2.10\scripts\ ( for windows that is )
Gmic_In_Main_Menu.scm (1.2 KB)

Thank you very much for the help :slight_smile: