There is a quite simple way to create a new custom blending mode in G’MIC.
Let me explain it briefly.
There is a command
blend in G’MIC that takes a blending mode
bmode as a parameter, and then internally do a call to a command
_blend_bmode, which can be actually defined or redefined by the user if necessary (to create new blending modes or modify the behavior of existing ones).
What you have to know is that in a
_blend_bmode command, you’ll always have only two images selected, the first one being the base layer (so layer
a with Pegtop’s convention), and the second one, the blend layer (so layer
b). G’MIC expects you only modify the second image, with the result of the blending at 100% opacity, so in your case, implementing your new blending mode is as simple as adding :
.gmic file. Then, you can use it directly in the
blend command, and the
opacity argument is automatically managed.
$ gmic sample tiger,lena +blend ,custom +blend ,custom,0.4
 is blended with 100% opacity, image
 with 40% opacity).