"fx_clut_from_ab" not consistent on Windows CLI

Helle everyone,

I used a portable Gimp version and the according G’MIC version with log-output to help me with the wanted command line to use “fx_clut_from_ab”. From the QT-GUI it works fine for me getting working cube-files (luts). The log has some abstraction to it, but it already gave some idea about the used filter and its settings.

While trying to make the command line work (with “gmic-3.2.1-cli-win64”), I noticed these things.

EXAMPLE 1

gmic “K:/gmic/source.png” “K:/gmic/target.png” fx_clut_from_ab 0,4,“K:/gmic/”,“output_cli_heute.cube”,50 -output NUL

[gmic]-0./ Start G’MIC interpreter.
[gmic]-0./ Input file ‘K:/gmic/source.png’ at position 0 (1 image 1920x852x1x4).
[gmic]-1./ Input file ‘K:/gmic/target.png’ at position 1 (1 image 1920x852x1x4).
[gmic]-2./ Output images [0,1] as file ‘NUL’, with pixel type ‘auto’.
[gmic]-2./ End G’MIC interpreter.

Works, but the cube-file is maybe neutral, in any case it does not describe the difference between the two input files.

EXAMPLE 2:

gmic “K:/gmic/source.png” “K:/gmic/target.png” fx_clut_from_ab 0,4,“”,“”,50 rm. -o “K:/gmic/haldclut.png”

[gmic]-0./ Start G’MIC interpreter.
[gmic]-0./ Input file ‘K:/gmic/target.png’ at position 0 (1 image 1920x852x1x4).
[gmic]-1./ Input file ‘K:/gmic/source.png’ at position 1 (1 image 1920x852x1x4).
[gmic]-2./ Remove image [1] (1 image left).
[gmic]-1./ Output image [0] as png file ‘K:/gmic/haldclut_new.png’ (1 image 512x512x1x3).
[gmic]-1./ End G’MIC interpreter.

Looks also great from CLI, but the haldclut is pure white, or when switching the order of the two input files, it might be “right” or vice versa. It is only 8bit, although the provided input images are both 16bit and the haldclut seems to be neutral (default).

I would like to have a way, to use this via command line, primarily for a cube-file, but I also saw, that this “filter” does not work in Natron either. It also seems the case, that there is no description on the CLI-version G’MIC for this filter.

[gmic] Command ‘fx_clut_from_ab’ has the following description:
[gmic] No help available for command ‘fx_clut_from_ab’.
Try ‘gmic help’ for global help.

Since it seems to be working from Gimp, I hope that I only overlooked something obvious here…

Kind regards,
rengel

If the command you invoke does not work exactly as in the G’MIC-Qt plugin, then I suspect that your input files do not give the same value ranges as in GIMP.
Typically, what could happen is that your .png files are encoded with 16-bits/channel data (so, range [0,65535]), while the plug-in filter expects a [0,255] range.
For all 16-bits input images, I would suggest dividing the input by 257 before applying the filter, like:

gmic “K:/gmic/source.png” “K:/gmic/target.png” div[-2,-1] 257 fx_clut_from_ab 0,4,“K:/gmic/”,“output_cli_heute.cube”,50 quit

Don’t be afraid about the value precision, G’MIC stores all images in float-valued format, so dividing by 257 won’t make you lose any precision.

Thank you very much, this looks much better. I changed the argument to fx_clut_from_ab 2,4,“”,“”,50 to get it working for cube-files.