Skip to main content

Comparison of two images using the structural similarity algorithm (SSIM).

Project description


Comparison of two images using the structural similarity algorithm (SSIM). The resulting value varies between 1.0 for identical images and 0.0 for completely different images. It's based on the PIL and also supports GPU acceleration via pyopencl.


python3 -m pip install SSIM-PIL

Be sure to install a working version of pyopencl to benefit from faster parallel execution on the GPU. (The code was tested with OpenCl version 1.2.)

Usage Example

from SSIM_PIL import compare_ssim
from PIL import Image

image1 =
image2 =

# Compare images using OpenCL by default
value = compare_ssim(image1, image2)

#  Compare images using CPU-only version
value = compare_ssim(image1, image2, GPU=False)


For feedback please contact me over github:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

SSIM-PIL-1.0.14.tar.gz (6.9 kB view hashes)

Uploaded source

Built Distribution

SSIM_PIL-1.0.14-py3-none-any.whl (11.1 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page