Setting a custom path for searching the gmic_film_cluts.gmz file


(Carmelo Dr Raw) #1

I am trying to have my GMIC-in-PhotoFlow to find the gmic_film_cluts.gmz I am installing in a custom path.

What I tried to do is to set the GMIC_PATH environment variable to point to my custom path, however gmic still tries to download the CLUTs from internet and does not try to open the local files…

Could somebody explain me what those lines are actually doing:

    -if {!$>" && "(isfile(${_path_rc}gmic_film_cluts.gmz)" || "\
                   isfile(${-path_gimp}plug-ins/gmic_film_cluts.gmz)" || "\
                   isfile(${g_path_unix}gmic_film_cluts.gmz))}
      -if {isfile(${_path_rc}gmic_film_cluts.gmz)} -i ${_path_rc}gmic_film_cluts.gmz
      -elif {isfile(${-path_gimp}plug-ins/gmic_film_cluts.gmz)} -i ${-path_gimp}plug-ins/gmic_film_cluts.gmz
      -elif {isfile(${g_path_unix}gmic_film_cluts.gmz)} -i ${g_path_unix}gmic_film_cluts.gmz
      -endif
    -else -l[] -i http://gmic.eu/gmic_film_cluts.gmz -o ${_path_rc}gmic_film_cluts.gmz,uchar -endl
    -endif

and especially the -if {!$>" && construct?

Thanks!


(David Tschumperlé) #2

Hello Andrea,

Those lines try to locate the file gmic_film_cluts.gmz in various local folders, and if not found, try to download it from the G’MIC server.
The $> is the indice of the loop and has here values 0 (first iteration) or 1 (second iteration). The first iteration tries to load the clut file locally, while the second iteration tries to download the file from the Internet (if the first iteration failed, or if the requested clut is not present in the local file).

Anyway, allowing a custom path for storing the clut file has not been planed. And I wouldn’t recommend you have a copy of this file in your own custom path, because it happens I add some new CLUTs from time to time, and at the end, the update file always comes in the G’MIC resource folder (which is ~/.config/gmic on Unix).

Why not simply creating a folder ~/.config.gmic if it doesn’t exist and uses this to access G’MIC specific files ?
All important data files needed by filters are stored there, so I don’t see the point of having a copy of these files elsewhere :slight_smile:


(Carmelo Dr Raw) #3

The problem I have with the gmic_film_cluts.gmz file is windows-specific… a windows user is reporting that photoflow cannot apply the film emulations because the CLUTs are now found/not properly downloaded from internet.

Which command is used by G’MIC to download files from the server under Windows?

Thanks!


(David Tschumperlé) #4

The command is exactly the same, the only thing that changes is the value of the $_path_rc variable which links to %APPDATA/gmic instead of $HOME/.config/gmic.


(Carmelo Dr Raw) #5

I meant the command to download files if they are not found locally… is it wget? Or curl?

The idea is to avoid using APPDATA/gmic in order to make PhotoFlow a fully portable application, and therefore put all files in the PhF distribution tree… I’ve been trying to programatically set the GMIC_PATH variable during program initialization, but this doesn’t seem to work…


(David Tschumperlé) #6

The file is downloaded using libcurl (so not with an external call to curl or wget).
And you are right, setting environment variable GMIC_PATH should do the work,
for instance, with the CLI tool:

$ cd $HOME
$ mkdir foo
$ export GMIC_PATH=$HOME/foo
$ gmic -e \$_path_rc
[gmic]-0./ Start G'MIC interpreter.
[gmic]-0./ /home/dtschump/foo/gmic/
[gmic]-0./ End G'MIC interpreter.
$ gmic -clut summer
$ cd $HOME/foo/gmic
~/foo/gmic$ gmic -clut summer
[gmic]-0./ Start G'MIC interpreter.
[gmic]-0./ Input CLUT with name 'summer' and resolution 64.
[gmic]-1./ End G'MIC interpreter.
~/foo/gmic$ ls
total 1176
-rw-rw-r-- 1 dtschump dtschump  110405 déc.  12 12:40 clut_summer.cimgz
-rw-rw-r-- 1 dtschump dtschump 1091310 déc.  12 12:40 gmic_film_cluts.gmz