# NodeBox

Create visual output with Python programming code
Home Download Reference Tutorial Library Gallery About

# photobot.Layer.statistics()

## Syntax

    canvas.layers[i].statistics()

## Description

Returns a number of statistics of layer i's pixel data. These are:

- extrema: a list of 2-tuples giving the minimum and maximum pixel value for each band (red/green/blue/alpha).
- count: a list giving the total number of pixels for each band.
- sum: a list giving the sum of all pixels for each band.
- sum2: a list giving the squared sum of all pixels for each band.
- mean: a list giving the average pixel value for each band.
- median: a list giving the median pixel value for each band.
- rms: a list giving the root-median-square pixel value for each band.
- var: a list giving the variance pixel value for each band.
- stddev: a list giving the standard deviation pixel value for each band.

## Example

    import photobot
    canvas = photobot.canvas(100,100)
    canvas.layer("robot.jpg")
    stats = canvas.layers[1].statistics()
    print stats.mean
    >>>[68.778499999999994, 57.926200000000001, 46.7866, 255.0]