I noticed that there did not appear to be any existing .NET Platform bindings for libgmic, so I decided to write one.
I also had a request on the Paint.NET forum from a G’MIC filter developer for a way to call the G’MIC API from a Paint.NET plugin.
Please note that this is currently a beta version.
It currently only targets Windows and the .NET Framework, but it should be possible for it to work with .NET Core on Linux / macOS.
This would require changing the gmic-sharp code to use the correct native library name for each platform.
The wrapper consists of a 32-bit and 64-bit C++ libraries that wrap libgmic, and a managed library written in C# that calls into the appropriate C++ library for the current platform.
There is a Windows-based sample application that demonstrates the use of the library.
gmic-sharp-native provides the native interface between gmic-sharp and libgmic.
gmic-sharp is the library that .NET application use to call G’MIC.
gmic-sharp-example is the Windows-based sample application that demonstrates the use of gmic-sharp.
gmic-sharp-native uses the same dual-license as libgmic (CeCILL v2.1 or CeCILL-C v1), this makes it simpler to statically-link the Windows DLLs to G’MIC.
Both gmic-sharp and gmic-sharp-example use the MIT/X11 license, same as .NET Core.
That is really interesting!
I’d like to share these links from the G’MIC webpage.
We also have a Python binding almost ready for the libgmic. So, it seems a perfect timing to make both appear on the webpage, and communicate about alternative bindings.
What do you think ?
I don’t have a Windows machine right here to test unfortunately. Would it be possible to have a screenshot of the example application running, that I could put on the webpage ?
I added a note to my first post that the library is a Beta version.
I have been investigating Linux and macOS support for the gmic-sharp library, the main issue I see is that .NET Core does not currently have a built-in API for processing images that is can be used on all of its supported operating systems.
Added support for changing the host application name seen by G’MIC scripts
Added support for running on Linux and macOS when using .NET Standard 2.1
The CustomResourcePath property now supports paths with non-ASCII characters
See the Changelog for more information on the other changes.
Added a cross-platform example application, gmic-sharp-cli-example.
It is a .NET Core 3.1 Console application that mimics gmic-cli.
The current release includes native binaries for the following operating systems:
Ubuntu 20.4 64-bit (x64) Microsoft Windows 64-bit (x64) Microsoft Windows 32-bit (x86)
Now I see why the others don’t work. They need a space on the beginning of new line for it to work. That is not convenient, but I can work with it though.
\n will also work.
@PDN_GMIC Just one more thing. What I supposed to do when I have to use {} characters within the g’mic parser? I know that {} are reserved for c# to.string, so, I’m wondering if there is a workaround.
EDIT: Using double brackets is the escape. Had to search for a solution for a while.