Search by

content-true / image-unblur-pixel-compare

Content-true

Measure pixel changes between aligned original and restored RGB images

Package info

github.com/Content-true/image-unblur-pixel-compare

Homepage

pkg:composer/content-true/image-unblur-pixel-compare

Statistics

Installs: 1

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.1.0 2026-11-19 03:03 UTC

This package is auto-updated.

Last update: 2026-11-19 03:08:23 UTC


README

A dependency-free PHP library for measuring differences between aligned, decoded RGB images. It returns normalized mean absolute change, PSNR in decibels, and a per-channel difference array that a caller can render as a visual map. Pixel changes cannot establish that newly visible detail is real.

composer require content-true/image-unblur-pixel-compare
use ContentTrue\ImageUnblur\PixelCompare;

$original = [0, 0, 0, 100, 100, 100];
$edited   = [0, 0, 0, 120, 120, 120];
$report = PixelCompare::compare($original, $edited);
// pixels: 2; identical: false; difference: [0,0,0,20,20,20]

Decode PNG/JPEG and align dimensions in your own application before passing the flat row-major RGB arrays. This library does not open files or upload images. When reviewing an unblur image online result, keep the original and inspect text, faces and edges side by side: a high PSNR means smaller pixel differences, not greater truthfulness. The psnrDb value is null for identical images because the mathematical value is infinite.

Requires PHP 8.1+. Run php -d zend.assertions=1 -d assert.exception=1 tests/smoke.php. MIT license.