Testing : Qt-based version of the G'MIC plug-in for GIMP

@David_Tschumperle the Manjaro build in the link above is still from march 24th…

Yes sorry, I forgot to upload the package. This should be done now.

1 Like

It’s ok now, all the packages have been updated.

Great news : Sébastien has finally released the source code of G’MIC-Qt on github, licensed under GPL3.
Do not hesitate to play with it and report any weirdness ! Link : GitHub - c-koi/gmic-qt: G'MIC-Qt is a versatile front-end to the image processing framework G'MIC.

3 Likes

Hi David,

I tried to compile it on Manjaro, but I get many errors and compilation failed. Here’s what I get:

src/host_gimp.cpp:69:14: error: ‘GimpLayerModeEffects’ was not declared in this scope
 QMap<QString,GimpLayerModeEffects> BlendModesMap = {
          ^~~~~~~~~~~~~~~~~~~~
src/host_gimp.cpp:69:34: error: template argument 2 is invalid
 QMap<QString,GimpLayerModeEffects> BlendModesMap = {
                              ^
src/host_gimp.cpp:70:23: error: ‘GIMP_NORMAL_MODE’ was not declared in this scope
   { QString("alpha"), GIMP_NORMAL_MODE },
                   ^~~~~~~~~~~~~~~~
src/host_gimp.cpp:71:23: error: ‘GIMP_NORMAL_MODE’ was not declared in this scope
   { QString("alpha"), GIMP_NORMAL_MODE },
                   ^~~~~~~~~~~~~~~~
src/host_gimp.cpp:72:24: error: ‘GIMP_NORMAL_MODE’ was not declared in this scope
   { QString("normal"), GIMP_NORMAL_MODE },
                    ^~~~~~~~~~~~~~~~
src/host_gimp.cpp:73:26: error: ‘GIMP_DISSOLVE_MODE’ was not declared in this scope
   { QString("dissolve"), GIMP_DISSOLVE_MODE },
                      ^~~~~~~~~~~~~~~~~~
src/host_gimp.cpp:74:25: error: ‘GIMP_LIGHTEN_ONLY_MODE’ was not declared in this scope
   { QString("lighten"), GIMP_LIGHTEN_ONLY_MODE },
                     ^~~~~~~~~~~~~~~~~~~~~~
src/host_gimp.cpp:75:24: error: ‘GIMP_SCREEN_MODE’ was not declared in this scope
   { QString("screen"), GIMP_SCREEN_MODE },
                    ^~~~~~~~~~~~~~~~
src/host_gimp.cpp:76:23: error: ‘GIMP_DODGE_MODE’ was not declared in this scope
   { QString("dodge"), GIMP_DODGE_MODE },
                   ^~~~~~~~~~~~~~~
src/host_gimp.cpp:77:21: error: ‘GIMP_ADDITION_MODE’ was not declared in this scope
   { QString("add"), GIMP_ADDITION_MODE },
                 ^~~~~~~~~~~~~~~~~~
src/host_gimp.cpp:78:24: error: ‘GIMP_DARKEN_ONLY_MODE’ was not declared in this scope
   { QString("darken"), GIMP_DARKEN_ONLY_MODE },
                    ^~~~~~~~~~~~~~~~~~~~~
src/host_gimp.cpp:79:26: error: ‘GIMP_MULTIPLY_MODE’ was not declared in this scope
   { QString("multiply"), GIMP_MULTIPLY_MODE },
                      ^~~~~~~~~~~~~~~~~~
src/host_gimp.cpp:80:22: error: ‘GIMP_BURN_MODE’ was not declared in this scope
   { QString("burn"), GIMP_BURN_MODE },
                  ^~~~~~~~~~~~~~
src/host_gimp.cpp:81:25: error: ‘GIMP_OVERLAY_MODE’ was not declared in this scope
   { QString("overlay"), GIMP_OVERLAY_MODE },
                     ^~~~~~~~~~~~~~~~~
src/host_gimp.cpp:82:27: error: ‘GIMP_SOFTLIGHT_MODE’ was not declared in this scope
   { QString("softlight"), GIMP_SOFTLIGHT_MODE },
                       ^~~~~~~~~~~~~~~~~~~
src/host_gimp.cpp:83:27: error: ‘GIMP_HARDLIGHT_MODE’ was not declared in this scope
   { QString("hardlight"), GIMP_HARDLIGHT_MODE },
                       ^~~~~~~~~~~~~~~~~~~
src/host_gimp.cpp:84:28: error: ‘GIMP_DIFFERENCE_MODE’ was not declared in this scope
   { QString("difference"), GIMP_DIFFERENCE_MODE },
                        ^~~~~~~~~~~~~~~~~~~~
src/host_gimp.cpp:85:26: error: ‘GIMP_SUBTRACT_MODE’ was not declared in this scope
   { QString("subtract"), GIMP_SUBTRACT_MODE },
                      ^~~~~~~~~~~~~~~~~~
src/host_gimp.cpp:86:30: error: ‘GIMP_GRAIN_EXTRACT_MODE’ was not declared in this scope
   { QString("grainextract"), GIMP_GRAIN_EXTRACT_MODE },
                          ^~~~~~~~~~~~~~~~~~~~~~~
src/host_gimp.cpp:87:28: error: ‘GIMP_GRAIN_MERGE_MODE’ was not declared in this scope
   { QString("grainmerge"), GIMP_GRAIN_MERGE_MODE },
                        ^~~~~~~~~~~~~~~~~~~~~
src/host_gimp.cpp:88:24: error: ‘GIMP_DIVIDE_MODE’ was not declared in this scope
   { QString("divide"), GIMP_DIVIDE_MODE },
                    ^~~~~~~~~~~~~~~~
src/host_gimp.cpp:89:21: error: ‘GIMP_HUE_MODE’ was not declared in this scope
   { QString("hue"), GIMP_HUE_MODE },
                 ^~~~~~~~~~~~~
src/host_gimp.cpp:90:28: error: ‘GIMP_SATURATION_MODE’ was not declared in this scope
   { QString("saturation"), GIMP_SATURATION_MODE },
                        ^~~~~~~~~~~~~~~~~~~~
src/host_gimp.cpp:91:23: error: ‘GIMP_COLOR_MODE’ was not declared in this scope
   { QString("color"), GIMP_COLOR_MODE },
                   ^~~~~~~~~~~~~~~
src/host_gimp.cpp:92:23: error: ‘GIMP_VALUE_MODE’ was not declared in this scope
   { QString("value"), GIMP_VALUE_MODE }
                   ^~~~~~~~~~~~~~~
src/host_gimp.cpp:93:1: error: scalar object ‘{anonymous}::BlendModesMap’ requires one element in initializer
 };
 ^
src/host_gimp.cpp:98:29: error: ‘GimpLayerModeEffects’ has not been declared
                         GimpLayerModeEffects & blendmode,
                         ^~~~~~~~~~~~~~~~~~~~
src/host_gimp.cpp: In function ‘void gmic_qt_get_cropped_images(cimg_library::CImgList<float>&, cimg_library::CImgList<char>&, double, double, double, double, GmicQt::InputMode)’:
src/host_gimp.cpp:427:30: warning: ‘GimpDrawable* gimp_drawable_get(gint32)’ is deprecated: Use 'gimp_drawable_get_buffer' instead [-Wdeprecated-declarations]
 GimpDrawable *drawable = gimp_drawable_get(inputLayers[l]);
                          ^~~~~~~~~~~~~~~~~
In file included from /usr/include/gimp-2.0/libgimp/gimp.h:41:0,
             from src/host_gimp.cpp:25:
/usr/include/gimp-2.0/libgimp/gimpdrawable.h:51:16: note: declared here
 GimpDrawable * gimp_drawable_get                    (gint32         drawable_ID);
            ^~~~~~~~~~~~~~~~~
src/host_gimp.cpp:427:62: warning: ‘GimpDrawable* gimp_drawable_get(gint32)’ is deprecated: Use 'gimp_drawable_get_buffer' instead [-Wdeprecated-declarations]
 GimpDrawable *drawable = gimp_drawable_get(inputLayers[l]);
                                                          ^
In file included from /usr/include/gimp-2.0/libgimp/gimp.h:41:0,
             from src/host_gimp.cpp:25:
/usr/include/gimp-2.0/libgimp/gimpdrawable.h:51:16: note: declared here
 GimpDrawable * gimp_drawable_get                    (gint32         drawable_ID);
            ^~~~~~~~~~~~~~~~~
src/host_gimp.cpp:444:11: error: ‘GimpLayerModeEffects’ does not name a type
 const GimpLayerModeEffects blendMode = gimp_layer_get_mode(inputLayers[l]);
       ^~~~~~~~~~~~~~~~~~~~
src/host_gimp.cpp:455:31: error: ‘blendMode’ was not declared in this scope
     .arg(BlendModeStrings[blendMode])
                           ^~~~~~~~~
src/host_gimp.cpp: In function ‘void gmic_qt_output_images(cimg_library::CImgList<float>&, const cimg_library::CImgList<char>&, GmicQt::OutputMode, const char*)’:
src/host_gimp.cpp:548:3: error: ‘GimpLayerModeEffects’ was not declared in this scope
   GimpLayerModeEffects layer_blendmode = GIMP_NORMAL_MODE;
   ^~~~~~~~~~~~~~~~~~~~
src/host_gimp.cpp:558:9: error: ‘layer_blendmode’ was not declared in this scope
     layer_blendmode = gimp_layer_get_mode(inputLayers[p]);
     ^~~~~~~~~~~~~~~
src/host_gimp.cpp:613:13: error: ‘layer_blendmode’ was not declared in this scope
         layer_blendmode = gimp_layer_get_mode(inputLayers[p]);
         ^~~~~~~~~~~~~~~
src/host_gimp.cpp:621:13: error: ‘layer_blendmode’ was not declared in this scope
         layer_blendmode = GIMP_NORMAL_MODE;
         ^~~~~~~~~~~~~~~
src/host_gimp.cpp:621:31: error: ‘GIMP_NORMAL_MODE’ was not declared in this scope
         layer_blendmode = GIMP_NORMAL_MODE;
                           ^~~~~~~~~~~~~~~~
src/host_gimp.cpp:626:34: error: ‘layer_blendmode’ was not declared in this scope
                              layer_blendmode,
                              ^~~~~~~~~~~~~~~
src/host_gimp.cpp:699:11: error: ‘layer_blendmode’ was not declared in this scope
       layer_blendmode = GIMP_NORMAL_MODE;
       ^~~~~~~~~~~~~~~
src/host_gimp.cpp:699:29: error: ‘GIMP_NORMAL_MODE’ was not declared in this scope
       layer_blendmode = GIMP_NORMAL_MODE;
                         ^~~~~~~~~~~~~~~~
src/host_gimp.cpp:784:11: error: ‘layer_blendmode’ was not declared in this scope
       layer_blendmode = GIMP_NORMAL_MODE;
       ^~~~~~~~~~~~~~~
src/host_gimp.cpp:784:29: error: ‘GIMP_NORMAL_MODE’ was not declared in this scope
       layer_blendmode = GIMP_NORMAL_MODE;
                         ^~~~~~~~~~~~~~~~
make: *** [Makefile:1222: .obj/host_gimp.o] Error 1

Also, the git clone https://github.com/ct-koi/gmic-qt.git command failed with remote: Repository not found. fatal: repository 'https://github.com/ct-koi/gmic-qt/' not found error, as I’m not a git expert I had to download the git repo as a zip.

Hello Sébastien,
Yes, I’ve just forked the repo and started to hack on it to allow compilation for GIMP 2.9 :

This is a temporary repo (Seb is on vacations this week), but it should work right now.
I think Seb will merge the changes I’ve made on next week.

Thanks David,
Much less errors from you fork, but it still fails with:

src/host_gimp.cpp:84:33: error: ‘GIMP_LAYER_MODE_HSL_COLOR_LEGACY’ was not declared in this scope
 #define GIMP_COLOR_MODE         GIMP_LAYER_MODE_HSL_COLOR_LEGACY
                                 ^
src/host_gimp.cpp:84:33: note: in definition of macro ‘GIMP_COLOR_MODE’
 #define GIMP_COLOR_MODE         GIMP_LAYER_MODE_HSL_COLOR_LEGACY
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/host_gimp.cpp:120:1: error: could not convert ‘{{QString(((const char*)"alpha")), GIMP_LAYER_MODE_NORMAL}, {QString(((const char*)"alpha")), GIMP_LAYER_MODE_NORMAL}, {QString(((const char*)"normal")), GIMP_LAYER_MODE_NORMAL}, {QString(((const char*)"dissolve")), GIMP_LAYER_MODE_DISSOLVE}, {QString(((const char*)"lighten")), GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY}, {QString(((const char*)"screen")), GIMP_LAYER_MODE_SCREEN_LEGACY}, {QString(((const char*)"dodge")), GIMP_LAYER_MODE_DODGE_LEGACY}, {QString(((const char*)"add")), GIMP_LAYER_MODE_ADDITION_LEGACY}, {QString(((const char*)"darken")), GIMP_LAYER_MODE_DARKEN_ONLY_LEGACY}, {QString(((const char*)"multiply")), GIMP_LAYER_MODE_MULTIPLY_LEGACY}, {QString(((const char*)"burn")), GIMP_LAYER_MODE_BURN_LEGACY}, {QString(((const char*)"overlay")), GIMP_LAYER_MODE_OVERLAY_LEGACY}, {QString(((const char*)"softlight")), GIMP_LAYER_MODE_SOFTLIGHT_LEGACY}, {QString(((const char*)"hardlight")), GIMP_LAYER_MODE_HARDLIGHT_LEGACY}, {QString(((const char*)"difference")), GIMP_LAYER_MODE_DIFFERENCE_LEGACY}, {QString(((const char*)"subtract")), GIMP_LAYER_MODE_SUBTRACT_LEGACY}, {QString(((const char*)"grainextract")), GIMP_LAYER_MODE_GRAIN_EXTRACT_LEGACY}, {QString(((const char*)"grainmerge")), GIMP_LAYER_MODE_GRAIN_MERGE_LEGACY}, {QString(((const char*)"divide")), GIMP_LAYER_MODE_DIVIDE_LEGACY}, {QString(((const char*)"hue")), GIMP_LAYER_MODE_HSV_HUE_LEGACY}, {QString(((const char*)"saturation")), GIMP_LAYER_MODE_HSV_SATURATION_LEGACY}, {QString(((const char*)"color")), <expression error>}, {QString(((const char*)"value")), GIMP_LAYER_MODE_HSV_VALUE_LEGACY}}’ from ‘<brace-enclosed initializer list>’ to ‘QMap<QString, GimpLayerMode>’
 };
 ^
src/host_gimp.cpp: In function ‘void gmic_qt_get_cropped_images(cimg_library::CImgList<float>&, cimg_library::CImgList<char>&, double, double, double, double, GmicQt::InputMode)’:
src/host_gimp.cpp:454:30: warning: ‘GimpDrawable* gimp_drawable_get(gint32)’ is deprecated: Use 'gimp_drawable_get_buffer' instead [-Wdeprecated-declarations]
     GimpDrawable *drawable = gimp_drawable_get(inputLayers[l]);
                              ^~~~~~~~~~~~~~~~~
In file included from /usr/include/gimp-2.0/libgimp/gimp.h:41:0,
                 from src/host_gimp.cpp:25:
/usr/include/gimp-2.0/libgimp/gimpdrawable.h:51:16: note: declared here
 GimpDrawable * gimp_drawable_get                    (gint32         drawable_ID);
                ^~~~~~~~~~~~~~~~~
src/host_gimp.cpp:454:62: warning: ‘GimpDrawable* gimp_drawable_get(gint32)’ is deprecated: Use 'gimp_drawable_get_buffer' instead [-Wdeprecated-declarations]
     GimpDrawable *drawable = gimp_drawable_get(inputLayers[l]);
                                                              ^
In file included from /usr/include/gimp-2.0/libgimp/gimp.h:41:0,
                 from src/host_gimp.cpp:25:
/usr/include/gimp-2.0/libgimp/gimpdrawable.h:51:16: note: declared here
 GimpDrawable * gimp_drawable_get                    (gint32         drawable_ID);
                ^~~~~~~~~~~~~~~~~
make: *** [Makefile:1222: .obj/host_gimp.o] Error 1

I have a fairly recent Gimp 2.9.5 (commit ccc4b58), maybe it’s the problem.

You should try replacing GIMP_LAYER_MODE_HSL_COLOR_LEGACY by #define GIMP_COLOR_MODE GIMP_LAYER_MODE_HSV_COLOR_LEGACY.
I suspect your Gimp 2.9 API to be a bit older than mine, and this change has been made in the source code recently.

1 Like

That worked, David, thanks! the qt plugin compiles and runs fine on Manjaro.
I’ll try to update Gimp later, and revert the change you suggested.

Hi David,

stand alone version works great, but I get an error with qmake HOST=gimp

Project ERROR: gimp-2.0 development package not found

I have installed libgimp2.0, I don’t know what I’m missing.

Also gmic_qt is installed on the gmic_qt directory, is there a way to specify the target dir? I try qmake HOST=none TARGET= and it didn’t work

After a few tries I found that is DESTDIR, not TARGET…

You need the gimptool-2.0 binary installed as well as the GIMP include files.
On Ubuntu, the needed package for that is called libgimp2.0-dev. You have to find something similar in your distro.

I have that too. I did a fresh install on a VM and it work fine, so I guess is a problem with some libraries, but I’m not sure what can it be, I’ll look into that. And if everything fails I can always do a re-install.

Release of G’MIC 2.0.0 is almost there. Default downloads now link to today’s prerelease, so more people can try it !

http://gmic.eu/download.shtml

1 Like

Would it be possible to show the amount of scale under the preview?

1 Like

An edge case bug: In preview mode (0) (1:1 pixel size) the preview image aspect is affected by the aspect of the interface itself. Edit: only if the initial preview window is smaller than the source image!

Example: use deinterlace2x with aspect 16:9, reduce the width of the gui and stretch the height so it’s tall & thin. The preview image gets stretched in the opposite way - it gets wider relative to height.

Sorry I couldn’t find a stdlib filter to demonstrate with, but even a dummy filter which alters aspect would do.

Feature request:
More user control of preview zoom, e.g. option to save zoom factor with favs.

@iarga I was thinking the same thing!

2 Likes

Hi Andy,

Could you please give us a step-by-step ‘tutorial’ to reproduce the preview bug ?
We didn’t manage to reproduce it. Maybe you have tried an older version of the plug-in ?

I must apologise, I now know the cause and there is no bug - only lost information.

What’s actually happening is due to the preview crop. The filter in the example uses the input h/w ratio to calculate the output aspect, but of course if your preview window is smaller than the full image the h/w ratio could be different.

For example you may have a 16:9 input but if your preview is square and the edges are cropped, the filter will “see” this as a 1:1 ratio. So long as there’s no way of passing full image parameters to the filter there’s no way of fixing that.

Very sorry to have wasted your time :confounded:

Not sure I’ve get all the details of your issue, but wouldn’t it be interesting for a filter to have access to the preview window size in pixels, maybe having them stored in variables such as $_preview_width and $_preview_height ?

EDIT: In fact, this is already the case, these variables are defined by the plug-in, so a filter can get the preview size very easily.

1 Like

Very useful to know, I had no idea! :smiley:
I’ll be sure to make use of that, thanks.