### ImageMagick version

7.1.1-20 and older

### Operating system

Windows

### Operating system, version and so on

Windows 11

### Description

This is a very old bug. Perhaps it has always been present. When I re-wrote fx.c, I didn't understand the meanings of `skewness` and `kurtosis`, and I simply copied what the old fx code did. The code calls `GetImageStatistics()`, and multiplies all statistics by `QuantumScale`. That is correct for mean, median, maxima, minima and standard_deviation. It is incorrect for skewness and kurtosis. Those statistics are dimensionless, and should not be multiplied by QuantumScale. If we multiply an image by `k`, the mean and standard deviation should also multiply by `k`, but skewness and kurtosis should not change. (I don't know if entropy is also wrong.)


### Steps to Reproduce

A simple demonstration with the skewness of the red channel:
```
magick rose: -verbose info: |grep -i skewness |head -n 1
      skewness: 0.14630194
```
That number is correct. But if we use fx...
```
magick rose: -format "r=%[fx:skewness.r]\n" info:
r=3.4063576e-11
```
... the result is wrong.

The workaround is to multiply by QuantumRange:
```
D:\temp>%IM7DEV%magick rose: -format "r=%[fx:skewness.r*QuantumRange]\n" info:
r=0.14630194
```
I suppose this bug has always been present. If anyone uses fx for kurtosis or skewness, they probably know it needs to by multiplied by QuantumRange, and perhaps regard this an an "undocumented feature" rather than a bug.

If the bug is fixed, it might break existing scripts.

So I do not propose that this bug is fixed.


### Images

N/A
fx calculations of skewness and kurtosis
This is a GitHub Issue
repo:ImageMagick
owner:ImageMagick
Title : fx calculations of skewness and kurtosis
Issue date:

--- start body ---
### ImageMagick version

7.1.1-20 and older

### Operating system

Windows

### Operating system, version and so on

Windows 11

### Description

This is a very old bug. Perhaps it has always been present. When I re-wrote fx.c, I didn't understand the meanings of `skewness` and `kurtosis`, and I simply copied what the old fx code did. The code calls `GetImageStatistics()`, and multiplies all statistics by `QuantumScale`. That is correct for mean, median, maxima, minima and standard_deviation. It is incorrect for skewness and kurtosis. Those statistics are dimensionless, and should not be multiplied by QuantumScale. If we multiply an image by `k`, the mean and standard deviation should also multiply by `k`, but skewness and kurtosis should not change. (I don't know if entropy is also wrong.)


### Steps to Reproduce

A simple demonstration with the skewness of the red channel:
```
magick rose: -verbose info: |grep -i skewness |head -n 1
      skewness: 0.14630194
```
That number is correct. But if we use fx...
```
magick rose: -format "r=%[fx:skewness.r]\n" info:
r=3.4063576e-11
```
... the result is wrong.

The workaround is to multiply by QuantumRange:
```
D:\temp>%IM7DEV%magick rose: -format "r=%[fx:skewness.r*QuantumRange]\n" info:
r=0.14630194
```
I suppose this bug has always been present. If anyone uses fx for kurtosis or skewness, they probably know it needs to by multiplied by QuantumRange, and perhaps regard this an an "undocumented feature" rather than a bug.

If the bug is fixed, it might break existing scripts.

So I do not propose that this bug is fixed.


### Images

N/A
--- end body ---
