Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

GMImage.Statistics

Calculate statistics for an image.

Component Version macOS Windows Linux Server iOS SDK
GraphicsMagick 14.1 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "GMImage.Statistics" )

Parameters

none

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 ) ]

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 } }

Release notes

  • Version 14.1
    • Added GMImage.Statistics function.

This function checks for a license.

Created 22nd January 2024, last changed 25th January 2024


GMImage.Spread - GMImage.Stegano

💬 Ask a question or report a problem