GMImage.Statistics
------------------

Calculate statistics for an image.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [GraphicsMagick](component_GraphicsMagick.md) | [14.1](newinversion141.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "GMImage.Statistics"; ImageRef ) 

**MBS**( **"GMImage.Statistics";** /\* Calculate statistics for an image. \*/  
**$ImageRef**) /\* The image reference number.e.g. 1 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| ImageRef | The image reference number. | 1 |

### Result

Returns JSON or error.

### Description

Calculate statistics for an image.  
ImageStatistics computes common statistics (currently maximum, minimum, mean and standard deviation) for the available image channels. The per-channel values are returned in an ImageStatistics structure as JSON. Statistics are normalized to the range 0.0 to 1.0. Multiply values by 65535 to obtain the statistics in quantum units. Statistics for non-existent channels are set to zero.  
If all colors have a minimum of zero, you have some black pixels. Same if red, green and blue maximum are all 1, you have some white pixels.  
### Examples

Queries statistics for an image:

 Set Field \[ Test::json ; MBS ( "GMImage.Statistics"; $ImageRef ) \]  
<small>  
Example result:   
{ "red" : { "maximum" : 1 , "minimum" : 0 , "mean" : 0.555333 , "stddev" : 0.311282 , "variance" : 0.096896 }, "green" : { "maximum" : 1 , "minimum" : 0 , "mean" : 0.556835 , "stddev" : 0.293437 , "variance" : 0.086105 }, "blue" : { "maximum" : 1 , "minimum" : 0 , "mean" : 0.571373 , "stddev" : 0.287351 , "variance" : 0.082571 }, "opacity" : { "maximum" : 0 , "minimum" : 0 , "mean" : 0 , "stddev" : 0 , "variance" : 0 } } </small>### Release notes

- **Version 14.1**
    - Added [GMImage.Statistics](https://www.mbsplugins.eu/GMImageStatistics.shtml) function.

### Blog Entries

- [New in MBS FileMaker Plugin 14.1](https://www.mbsplugins.de/archive/2024-03-19/New_in_MBS_FileMaker_Plugin_14/monkeybreadsoftware_blog_filemaker)
- [Neues MBS Plugin 14.1 für Claris FileMaker](https://www.mbsplugins.de/archive/2024-03-12/Neues_MBS_Plugin_141_für_Clar/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin 14.1 for Claris FileMaker](https://www.mbsplugins.de/archive/2024-03-12/MBS_Plugin_141_for_Claris_File/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 14.1pr1](https://www.mbsplugins.de/archive/2024-02-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 22nd January 2024 , last changed 22nd November 2024

  
[GMImage.Spread](GMImageSpread.md) - [GMImage.Stegano](GMImageStegano.md)

[HTML Version](GMImageStatistics.shtml)