Contrast is a measure of the difference across a spread of pixel intensities within an image.

As such, contrast can be measured using the standard deviation of pixel intensities within an image. A high standard deviation means the image has a high contrast.