GMIC needs a patch for recent Gimp

The recent GIMP (GIT 2017/03/25) has renamed
GIMP_LAYER_MODE_HSV_COLOR_LEGACY to
GIMP_LAYER_MODE_HSL_COLOR_LEGACY

Therefore the following patch is needed

— src/gmic_gimp_gtk.cpp.ORIG 2017-03-25 12:52:17.835176235 +0100
+++ src/gmic_gimp_gtk.cpp 2017-03-25 14:06:45.349219958 +0100
@@ -404,7 +404,7 @@
#define GIMP_LIGHTEN_ONLY_MODE GIMP_LAYER_MODE_LIGHTEN_ONLY_LEGACY
#define GIMP_HUE_MODE GIMP_LAYER_MODE_HSV_HUE_LEGACY
#define GIMP_SATURATION_MODE GIMP_LAYER_MODE_HSV_SATURATION_LEGACY
-#define GIMP_COLOR_MODE GIMP_LAYER_MODE_HSV_COLOR_LEGACY
+#define GIMP_COLOR_MODE GIMP_LAYER_MODE_HSL_COLOR_LEGACY
#define GIMP_VALUE_MODE GIMP_LAYER_MODE_HSV_VALUE_LEGACY
#define GIMP_DIVIDE_MODE GIMP_LAYER_MODE_DIVIDE_LEGACY
#define GIMP_DODGE_MODE GIMP_LAYER_MODE_DODGE_LEGACY

I think that might be the same for the 'buntu based Gimp 2.9.5 ppa

Trying to compile gmic against the 2.9.5 dev fails.

gmic-cmake.txt.zip (1.6 KB)

using cmake

Edit:
OK that was a couple of days ago,

code refreshed and editing line 407 as previous post, gmic_gimp_gtk now compiles.
That works fine in the VM I used for the purpose.
However, my regular Kubuntu 16.04 does not normally have the opencv and GraphickMagick libraries installed. Not there and gmic-gimp does not load.

Question are these essential and should be considered dependencies or can I compile gmic_gimp_gtk without them?

Edit: some time later: 27th.
Seems to compile ok without the opencv / graphicsmagick++ lib’s.

Thanks for the feedback.
To compile the plug-in, OpenCV and ImageMagick libraries should not be used actually, so maybe there is an error in the CMakefile.txt ?
I’m definitely not an expert in the use of CMake, so if someone can help, he is more than welcome !

@Carmelo_DrRaw maybe ?
It seems the plug-in compiled with the CMake links with a lot of ‘useless’ libraries, like TIFF/JPEG/GRAPHICSMAGICK/OPENEXR and OPENCV.
Any idea how to remove these dependencies for the plug-in (but let them for the CLI interface of course) ?
Thanks :slight_smile:

Hi David,

sorry for answering late… I didn’t know that those libraries were not needed for the plug-in.

The easiest way to fix this is to remove the corresponding lines in the target_link_libraries cmake command for the plug-in. Those are the lines starting from 309 in CMakeLists.txt:

Can you do this directly in the official G’MIC github repository?

Thanks!

Hi Andrea, I think this is the thing I’ve tried at first, but I got link errors anyway.
I think this is because the macros enabling the use of these libs are still enabled when compiling the plug-in (things like -Dcimg_use_jpeg or -Dcimg_use_tiff), but they shouldn’t be defined in this case.

@rich2005 @David_Tschumperle I have modified the CMakeLists.txt file such that TIFF/JPEG/GRAPHICSMAGICK/OPENEXR and OPENCV do not get linked to the plug-in.

However, at the moment I have no way to do extensive tests to make sure my modifications are correct.

Could one of you possibly get my G’MIC fork from here and check if everything compiles & links as expected?

If yes, David can go ahead an incorporate the full request in the official repository…

Thanks!

1 Like

That seems to work as expected. A big thank @Carmelo_DrRaw !

1 Like

Works fine here in Kubuntu 16.04, information while compiling is not much different from before, still checking for opencv and GraphicsMagick++ which I removed earlier as a fix. Removing openEXR also removes Gimp so that is not a good idea. A bit of the output

[quote]X11_LIBRARY_DIRS:
– Checking for module ‘fftw3>=3.0’
– Found fftw3, version 3.3.4
– Checking for module ‘opencv’
– No package ‘opencv’ found
– Checking for module ‘GraphicsMagick++’
– No package ‘GraphicsMagick++’ found
– Found TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (found version “4.0.6”)
– Found PNG: /usr/lib/x86_64-linux-gnu/libpng.so (found version “1.2.57”)
– Found JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so
– Checking for module ‘OpenEXR’
– Found OpenEXR, version 2.2.0
– Checking for module ‘gimp-2.0’
– Found gimp-2.0, version 2.9.5
– Checking for module ‘gimpui-2.0’
– Found gimpui-2.0, version 2.9.5
– Configuring done[/quote]

The compiled plugin gmic_gimp_gtk is a bit smaller (6.5M) that the update from yesterday from the regular git (6.7M).