Skip to main content

Python implementation of SSIMULACRA2 image quality metric

Project description

SSIMULACRA2

PyPI - Version PyPI - Python Version

Python implementation of SSIMULACRA2 (Structural SIMilarity Unveiling Local And Compression Related Artifacts) - a perceptual image quality metric designed to accurately detect compression artifacts.

Description

SSIMULACRA2 is a full-reference image quality metric that aims to estimate human perception of image quality, specifically focusing on compression artifacts. This Python package provides a clean, efficient implementation that closely follows the original C++ algorithm.

SSIMULACRA2 scores range from 100 (perfect quality) down to negative values (extremely poor quality):

  • negative scores: extremely low quality, very strong distortion
  • 10: very low quality (average output of cjxl -d 14 / -q 12 or libjpeg-turbo quality 14, 4:2:0)
  • 30: low quality (average output of cjxl -d 9 / -q 20 or libjpeg-turbo quality 20, 4:2:0)
  • 50: medium quality (average output of cjxl -d 5 / -q 45 or libjpeg-turbo quality 35, 4:2:0)
  • 70: high quality (hard to notice artifacts without comparison to the original)
  • 80: very high quality (impossible to distinguish from the original in a side-by-side comparison at 1:1)
  • 85: excellent quality (impossible to distinguish from the original in a flip test at 1:1)
  • 90: visually lossless (impossible to distinguish from the original in a flicker test at 1:1)
  • 100: mathematically lossless

Installation

pip install ssimulacra2

Usage

Command Line

# Basic usage
ssimulacra2 original.png compressed.png

# For just the score without interpretation
ssimulacra2 original.png compressed.png --quiet

Python API

from ssimulacra2 import compute_ssimulacra2, compute_ssimulacra2_with_alpha

# Basic usage
score = compute_ssimulacra2("original.png", "compressed.png")
print(f"Quality score: {score:.2f}")

# For images with alpha channel (automatically uses both dark and light backgrounds)
score = compute_ssimulacra2_with_alpha("original.png", "compressed.png")
print(f"Quality score with alpha: {score:.2f}")

Features

  • Accurate: Closely follows the original C++ implementation
  • Alpha Support: Special handling for images with transparency
  • Multi-scale Analysis: Examines image quality at multiple resolution scales
  • XYB Color Space: Uses a perceptual color space for more accurate results
  • Easy to Use: Simple command-line interface and Python API

Requirements

  • Python 3.8+
  • NumPy
  • SciPy
  • Pillow (PIL)
  • scikit-image
  • OpenCV

License

This project is licensed under the BSD 3-Clause License - see the LICENSE file for details.

Acknowledgements

This implementation is based on the original SSIMULACRA2 algorithm developed for the JPEG XL project.

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

ssimulacra2-0.1.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ssimulacra2-0.1.0-py3-none-any.whl (10.5 kB view details)

Uploaded Python 3

File details

Details for the file ssimulacra2-0.1.0.tar.gz.

File metadata

  • Download URL: ssimulacra2-0.1.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for ssimulacra2-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b26e5a95860159c7a71a9b4a8aae88efb4f8e580ad001d681ea83bd76ebc59b2
MD5 6f77b547f115649bba88b4f5aa600f8c
BLAKE2b-256 05a3c22fd482fb00757fd0bfc93f920fc107c59a8fa9f59438019cd38f3eceeb

See more details on using hashes here.

File details

Details for the file ssimulacra2-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: ssimulacra2-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for ssimulacra2-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 61f91d79123d40e4024dc41a9a238c20841cab4814771a90d8d7cf005f3cb2b2
MD5 ad47b5f87ebf431fe16925ac447ccef1
BLAKE2b-256 db0b983655bc08a608f160ab52103105fd0b382c51fbd981b270e434dcbeeade

See more details on using hashes here.

Supported by

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