A command-line tool to calculate the Structural Similarity Index (SSIM) between two PNG images.
- Create a virtual environment:
python -m venv .venv- Activate the virtual environment:
# On Linux/macOS
source .venv/bin/activate
# On Windows
.venv\Scripts\activate- Install dependencies:
pip install -r requirements.txtCalculate SSIM between two PNG images:
python run.py image1.png image2.pngpython run.py photo1.png photo2.pngOutput:
SSIM Index: 0.8542
- Automatically trims images by removing background color (based on top-left pixel)
- Converts images to grayscale for comparison
- Resizes images to the same dimensions for accurate comparison
- Returns SSIM index value between -1 and 1 (higher values indicate greater similarity)