first attempts with gmic-cli, garbage output?

looking for some more batch power, I took another look at gmic.

Got the gimp-plugin and cli-version available. I tried the latest 2.9.4 and the current ‘prerelease’ version (Windows btw).

In gimp I have one of the filters dialed in how I like. From the ‘verbose - layer name’ option, I see that what I applied is the command iain_nr_2019 1,0,0,0,0.5,1,0,8.55,3,0,3,1,0.906,4,0.

I know try to do that from the command-line.

As a test, I try the gmic -input test.tif -glow 10% -display it seems to be already.

If I try gmic -input test.tif -iain_nr_2019 1,0,0,0,0.5,1,0,8.55,3,0,3,1,0.906,4,0 -display I get some sort of garbage output:

image

Zooming in shows blocking that’s not in the source image (uncompressed 16bit tiff):
image .

Am I doing something wrong?

You probably need to divide by 257 first (I assume it’s a 16-bit tiff with max 65535). Also you no longer require hyphen before each command. gmic input test.tif div 257 iain_nr... and so on.

yeah just figured it out myself (was trying for quite some time though :frowning:).

Reading that it outputs 32bit floating-point tiff by default, it registered that what I was looking as looks like overflow, and maybe the filters want floating-point data between 0.0 and 1.0.

Why would I need to divide by 257, to get in a 0-255 range? That can’t be the default I assume.

I tried now with gmic input test.tif div 65535 ian_nr_2019 ..... mul 65535 output test2.tif,ushort and I seem to get a good output file. Is that just look?

I would understand ‘assuming floating point range’, or ‘just work with whatever the input file is’, but to assume ‘0.0 - 255.0’ seems random (and hard for filter writers :P).

Reminds me of libvips where you need to convert and cast the values to whatever is needed.

Yes, range handling isn’t always easy or obvious because g’mic “core” doesn’t really care. It’s left to each filter writer to decide based on needs - the expected inputs, image editor and so on. The GUI tends to hide a lot of that with either cut or normalize, so you’ll have to consider ranges more carefully in cli.

There’s a fairly steep learning curve, we’ve all been there but it’s worth it :slight_smile:

Iain doesn’t appear to manipulate the range; therefore, it is something that you would have to do yourself.