I'm also getting some strange numbers from the Perl Magick Statistics() method.
To illustrate (in Perl Magick - since I don't use the command line)
The (rather clumsy) code below generates a 3 pixel image including alpha channel and assigns different values to each pixel.
Code: Select all
    my $image = Image::Magick->new;
    my @pixel;
    $image->Set(size=>'3x1');
    $image->Read('canvas:black');
    $image->Color(color=>'blue');
    $image->Set(alpha=>'On');
    $image->SetPixel(x=>0, y=>0, color=>[1,1,0.75,1]);
    $image->SetPixel(x=>1, y=>0, color=>[1,0,0.5,0.2]);
    $image->SetPixel(x=>2, y=>0, color=>[0,0,0.25,1]);
    $image->Identify();
    print "Mean r = ".$image->Get('%[fx:mean.r]')."\n";
    print "Mean g = ".$image->Get('%[fx:mean.g]')."\n";
    print "Mean b = ".$image->Get('%[fx:mean.b]')."\n";
    print "Mean   = ".$image->Get('%[fx:mean]')."\n";
    print "Mean a = ".$image->Get('%[fx:mean.a]')."\n";
    print "Mean o = ".$image->Get('%[fx:mean.o]')."\n\n";
    print "Maxima r = ".$image->Get('%[fx:maxima.r]')."\n";
    print "Maxima g = ".$image->Get('%[fx:maxima.g]')."\n";
    print "Maxima b = ".$image->Get('%[fx:maxima.b]')."\n";
    print "Maxima   = ".$image->Get('%[fx:maxima]')."\n";
    print "Max      = ".$image->Get('%[fx:max]')."\n";
    print "Maxima a = ".$image->Get('%[fx:maxima.a]')."\n";
    print "Maxima o = ".$image->Get('%[fx:maxima.o]')."\n\n";
    print "Minima r = ".$image->Get('%[fx:minima.r]')."\n";
    print "Minima g = ".$image->Get('%[fx:minima.g]')."\n";
    print "Minima b = ".$image->Get('%[fx:minima.b]')."\n";
    print "Minima   = ".$image->Get('%[fx:minima]')."\n";
    print "Min      = ".$image->Get('%[fx:min]')."\n";
    print "Minima a = ".$image->Get('%[fx:minima.a]')."\n";
    print "Minima o = ".$image->Get('%[fx:minima.o]')."\n\n";
    my @stats = $image->Statistics();
    my ($i, $j);
    for ($i=0; $i<4; $i++) {
        for ($j=0; $j<8; $j++) {
            print $stats[$i*8+$j]."/";
        }
        print "\n";
    }
Code: Select all
Image: black
  Base filename: black
  Format: CANVAS (Constant image uniform color)
  Class: DirectClass
  Geometry: 3x1+0+0
  Units: Undefined
  Type: PaletteAlpha
  Base type: TrueColorAlpha
  Endianess: LSB
  Colorspace: sRGB
  Depth: 8/16-bit
  Channel depth:
    Red: 1-bit
    Green: 1-bit
    Blue: 16-bit
    Alpha: 4-bit
  Channel statistics:
    Pixels: 3
    Red:
      min: 0 (0)
      max: 255 (1)
      mean: 170 (0.666667)
      standard deviation: 120.208 (0.471405)
      kurtosis: -1.5
      skewness: -0.707107
      entropy: 0.918296
    Green:
      min: 0 (0)
      max: 255 (1)
      mean: 85 (0.333333)
      standard deviation: 120.208 (0.471405)
      kurtosis: -1.5
      skewness: 0.707107
      entropy: 0.918296
    Blue:
      min: 63.75 (0.25)
      max: 191.25 (0.75)
      mean: 127.5 (0.5)
      standard deviation: 52.0517 (0.204124)
      kurtosis: -1.5
      skewness: 0
      entropy: 1
    Alpha:
      min: 51 (0.2)
      max: 255 (1)
      mean: 187 (0.733333)
      standard deviation: 96.1665 (0.377124)
      kurtosis: -1.5
      skewness: -0.707107
      entropy: -nan
  Image statistics:
    Overall:
      min: 0 (0)
      max: 255 (1)
      mean: 142.375 (0.558333)
      standard deviation: 101.066 (0.396337)
      kurtosis: -1.28206
      skewness: -0.213977
      entropy: 0.709148
  Colors: 3
  Histogram:
         1: (  0,  0, 64,255) #000040FF srgba(0,0,64,1)
         1: (255,  0,128, 51) #FF008033 srgba(255,0,128,0.2)
         1: (255,255,191,255) #FFFFBFFF srgba(255,255,191,1)
  Rendering intent: Perceptual
  Gamma: 0.454545
  Chromaticity:
    red primary: (0.64,0.33)
    green primary: (0.3,0.6)
    blue primary: (0.15,0.06)
    white point: (0.3127,0.329)
  Tile geometry: 3x1+0+0
  Alpha color: grey74
  Background color: white
  Border color: srgb(223,223,223)
  Transparent color: none
  Interlace: None
  Intensity: Undefined
  Compose: Over
  Page geometry: 3x1+0+0
  Dispose: Undefined
  Iterations: 0
  Compression: Undefined
  Orientation: Undefined
  Properties:
    date:create: 2017-02-09T11:00:47+00:00
    date:modify: 2017-02-09T11:00:47+00:00
    signature: 2721d18926bbdf0ebf14e8943047e4232109e609a135f0b82fdd882059921cc9
  Tainted: True
  Filesize: 0B
  Number pixels: 3
  Pixels per second: 3PB
  User time: 0.000u
  Elapsed time: 0:01.000
  Version: ImageMagick 7.0.2-4 Q16 x86_64 2016-12-05 http://www.imagemagick.org
This appears to give all the correct statistical data.
The output from the various fx:maxima, minima and mean functions are as follows:
Code: Select all
Mean r = 0.666667
Mean g = 0.333333
Mean b = 0.5
Mean   = 0.5
Mean a = 0
Mean o = 0
Maxima r = 1
Maxima g = 1
Maxima b = 0.749999
Maxima   = 0.749999
Max      = 0
Maxima a = 1
Maxima o = 1
Minima r = 0
Minima g = 0
Minima b = 0.250001
Minima   = 0.250001
Min      = 0
Minima a = 0.2
Minima o = 0.2
- fx:mean gives and incorrect value. It appears to actually give the value from fx:maxima.b
fx:mean.a and fx:mean.o give incorrect values. Interestingly if the fx:mean call (just before the fx:mean.a call) is omitted the value of fx:mean.a changes (but is still incorrect) !
fx:Maxima gives an incorrect value, again apearing to give the fx:maxima.b value.
fx:Minima - as above.
fx:Max & fx:Min give no values (and I didn't expect then to)
All others appear to function as expected. 
Code: Select all
1/0/1/0.333333333333333/0.471404520791032/-1.5/0.707106781186548/0.91829583405449/
16/0.25/0.75/0.5/0.204124145231932/-1.50000000000001/0/1/
4/0.2/1/0.733333333333333/0.377123616632825/-1.50000000000001/-0.707106781186548/-nan/
1/2.74310389084049e+303/-2.74310389084049e+303/0/0/0/0/-nan/
Any chance you could take a look at these issues?
Regards
Mike