But it should specifically say. There is something mysterious going on there. This suggests Iain’s filter isn’t running at all, though you seemingly included it in the pipeline.

Please:

- provide the complete pipeline, from
`gmic`

to carriage return, and not abridged.
- Consider reading Cheat #4 and if it not too alien to you, try putting
`-verbose 3`

as the first pipeline command; it would be useful to find, in a more verbose reporting, what mechanism is causing the (possible) removal of Iain’s command.
- Further consider reading the Debuggery section and locating how G’MIC is itemizing the command line. I suspect that such itemization is not what we would expect it to be.

Thank you in advance for that!

If you are terminally bored, here are my tests. I cannot see any issues running these from the command line. Here are the gory details. First — don’t let the following massive commands frighten you. Their aim is to put the investigation of `-iain_moire_removal_NP`

and `afre_sharpenfft`

on a precise, numerical footing so that one could diagnose in a concrete way if these commands are doing their jobs or not (and — if the latter — whether they need to be fixed).

The numerical basis of choice is Variance, a measure of how image values vary from a mean. For an absolute solid gray image, the variance is zero because *every* pixel equals the image mean. In more typical circumstances, variance is some positive number, one that gets large quickly for modest variations of specific pixels from the general mean. The gist of the test is to introduce a moire-like pattern to an initially variance zero image, then see how the filters perform.

```
gmic v 0 m "mry: -input 2,1,1,5,u([{w#-1},{h#-1},1,1,1]) rbf. {w#-2},{h#-2} n. 0,700 cos. sqr. n. -5,5 add cut. 0,255" srand 1234 i 512,512,1,3,[127,127,127] eval "stats(#0)[3]" v + e "Variance @ Init: "'${}' v - mry. eval "stats(#0)[3]" v + e "Variance after Moire: "'${}' v - o. ~/mtest_00.png -iain_moire_removal_NP 4,5,1 -eval "stats(#0)[3]" v + e "Variance after Iain's MoireRemoval: "'${}' v - o. ~/mtest_01.png -afre_sharpenfft 5,2 eval "stats(#0)[3]" v + e "Variance after AfreSharp: "'${}' v - o. ~/mtest_02.png
```

You need not get lost in the detail with this. It:

- Defines a pseudo moire pattern generator,
`mry`

- Introduces a flat gray image and prints its variance. Unsurprisingly it is zero.
- Injects a pseudo Moire-ish noise pattern into the image with
`mry`

and prints its variance. It is a large-ish positive number
- Runs
`iain_moire_removal_NP 4,5,1`

on the image and prints its variance. Here, variance reduces considerably.
- Runs
`-afre_sharpenfft 5,2`

on the image and prints its variance. No surprise: the variance goes up a bit, but not nearly as much as with the original noise injection.
- Along the way, it dumps intermediary images: after noise injection, mtest_00.png, after moire reduction, mtest_01.png and after afre-sharpening: mtest_02.png.

And so, in considerably less time than it takes to describe it, here is the test run:

```
[gmic]-1./ Variance @ Init: 0
[gmic]-1./ Variance after Moire: 12.501370084773514
[gmic]-1./ Variance after Iain's MoireRemoval: 1.4889610189454463
[gmic]-1./ Variance after AfreSharp: 4.2067888788877168
```

In light of this concrete variance measure, I can observe that — run from the CLI — Iain’s moire noise remover does remove (most) moire noise and have a quantitative sense of how well it is doing. I’m pretty confident that Iain;s script works, and Afre’s fft-based sharpener bumps the variance, also expected: it is an image sharpener. Sharpeners increase image variance. Here are the test images.

**mtest_00.png**

**mtest_01.png**

**mtest_02.png**

However, there is a pernicious class of images where these filters apparently do not do anything at all. I have modified the test script such that it produces a test image consisting of alternating black and white stripes. The image average is the same as the previous one, but *every* pixel now varies from the image mean by the biggest extreme possible, so the variance is astronomical.

```
gmic v 0 m "mry: -input 2,1,1,5,u([{w#-1},{h#-1},1,1,1]) rbf. {w#-2},{h#-2} n. 0,700 cos. sqr. n. -5,5 add cut. 0,255" srand 1234 i 512,512,1,3 f. 0,255 eval "stats(#0)[3]" v + e "Variance @ Init: "'${}' v - mry. eval "stats(#0)[3]" v + e "Variance after Moire: "'${}' v - o. ~/mtest_03.png -iain_moire_removal_NP 4,5,1 -eval "stats(#0)[3]" v + e "Variance after Iain's MoireRemoval: "'${}' v - o. ~/mtest_04.png -afre_sharpenfft 5,2 eval "stats(#0)[3]" v + e "Variance after AfreSharp: "'${}' v - o. ~/mtest_05.png
```

Here is the test run:

```
[gmic]-1./ Variance @ Init: 16256.270670917093
[gmic]-1./ Variance after Moire: 15856.637440184575
[gmic]-1./ Variance after Iain's MoireRemoval: 15852.934917493372
[gmic]-1./ Variance after AfreSharp: 16056.331219528456
```

This tells us that there are images — exhibiting a great deal of variance from the outset — where Iain’s filter has negligible effect. Now, where do your test images fall in this spectrum? I don’t know. You haven’t provided test images. Ah me. The lack of apparent non-performance may lie in the nature of your test images. In this run, there is no apparent effect.

**mtest_03.png**

**mtest_04.png**

**mtest_05.png**

So there is a class of images where Iain’s filter cannot get much purchase. How much are your images like those? In the main, from my test bed, the filters seem to be working as expected. However, G’MIC’s operating log, presented in your early post, is strange. The direction of my inqueries would be toward that.