A tool for doing quick perceptual image difference analysis
Project description
ez_img_diff
A tool for doing quick percieved image difference analysis
What does ez_img_diff do?
ez_img_diff is a CLI and api for doing a simple form of percieved image difference analysis with SSIM. This allows for tons of features, but the main one is being able to compare some sort of "baseline" image of an application to a "current" itteration in visual regression testing.
Down the road I will write a selenium integration to tie this whole process together!
Why should I use ez_img_diff?
There are a ton of great and more robust tools out there for this analysis, or for visual regression testing, but I found each of them had their own problems, here's a list:
Package | Issue |
---|---|
needle | Requires a Nose test runner, and had out of date dependencies |
pytest-needle | Works well, but cannot use webdiver_manager with it |
dpxdt | Didn't test, but was 7 years old and mostly focused on CI/CD usage |
Visual Regression Tracker | Works great, but for some of my use cases I need an API not a full application |
hermione | Could not use javascript/nodeJS for my use case |
specter | Could not use javascript/nodeJS for my use case |
Cypress-image-screenshot | Could not use javascript/nodeJS for my use case |
Quick-start
Installation
From source
- Clone this repo: https://github.com/Descent098/ez-img-diff
- Run
pip install .
orsudo pip3 install .
in the root directory
From PyPi
- Run
pip install ez_img_diff
Examples
API Examples
Compare 2 images without saving difference files
from ez_img_diff.api import compare_images
img1 = "baseline.png"
img2 = "current.png"
compare_images(im1, img2) # 14.03
Compare 2 images with saving difference and threshold files
from ez_img_diff.api import compare_images
img1 = "baseline.png"
img2 = "current.png"
compare_images(im1, img2, "difference.png", "threshold.png") # 14.03
CLI Usage
ez img diff
A tool for doing quick perceptual image difference analysis
Usage:
img_diff [-h] [-v]
img_diff (<img1> <img2>) [-o OUTPUT_FOLDER]
Options:
-h, --help show this help message and exit
-v, --version show program's version number and exit
-o OUTPUT_FOLDER, --output OUTPUT_FOLDER
the folder to output difference files to
so for example to get the diff of two images use:
$> img_diff baseline.png current.png
14.03
You can then store the diff and threshold of the two images with:
$> img_diff baseline.png current.png -o results
14.03
$> cd results && ls
diff.png
thresh.png
Notes
Some things to keep in mind:
- Output folder will have 2 files in it
diff.png
andthresh.png
diff.png
is the regular difference png, which shows where things differthresh.png
is the threshold png, which is much higher contrast and shows you where the biggest changes happened more clearly
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file ez_img_diff-0.1.0.tar.gz
.
File metadata
- Download URL: ez_img_diff-0.1.0.tar.gz
- Upload date:
- Size: 6.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3031a83e50ad13f39a09fde4b211afce8e5e2be9faeb4c3c65ac1d65eb324ca |
|
MD5 | 33a69296f8fd6198cb392d21eb093507 |
|
BLAKE2b-256 | db53d19a69bdbd57a0a59ea8a57e61372596af3e93797a432e632eed42d1fd6c |
File details
Details for the file ez_img_diff-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: ez_img_diff-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94e4809c087174e72b8af59651db1bf14c95a8f96e656f9ea58ba1f3db04c2a5 |
|
MD5 | f194ba8fa4e7f1b3e8c0c908e7f3078b |
|
BLAKE2b-256 | fab844e6acd5f5b8c4942039eddd323b08524068fd1a0d92a2159cb27eac3346 |