Skip to main content

dfrnt is a library for comparing PNG screenshots during automated testing and producing visual diffs.

dfrnt will compare images with identical names from automation and produce a result “diff” image that red-highlights regions in the image that differ.

dfrnt requires a minimum of 3 folders to be specified:

run_dir is the directory of screenshots from your run, aka ‘actual screenshots’ gold_dir directory of screenshots that are compared against, aka ‘expected screenshots’ diff_dir is the directory to output the visual diff images into

Invoking:

  1. You have a directory of images from your latest test run in “test/run” (test.png)

  2. You have a directory of the expected images in “test/gold” (test.png)

  3. You want the output of visual diffs to be placed in directory “test/diff”

from dfrnt import dfrnt

visual_diffs = dfrnt(run_dir=”test/run”, gold_dir=”test/gold”, diff_dir=”test/diff”)

visual_diffs.diff()

Output: Diff failed! test.png is not identical enough

A red-lined image showing the differences between run/test.png and gold/test.png is generated in diff/test.png

Optional Features: mask_dir is the directory to contain images with highlighted areas you wish to ignore in the diff. This is useful for ignoring portions of an image that always change, like date / time. These mask images should be transparent background PNGs

fuzzy is a “fuzziness” factor of how different images can be and still pass. If you experience jitter you should experimentally determine the lowest acceptable number you can use. Default is None, starting your binary search around ‘40’ is recommended

visual_diffs = visual_diffs = dfrnt(run_dir=”run”, gold_dir=”gold”, diff_dir=”diff”, mask_dir=”mask”, fuzzy=40)

Why is this project called ‘dfrnt’? To mock the modern practice of dropping vowels in software names to sound unique. Be glad I didn’t name it dfrntzlyr.

Metadata

Release files for dfrnt 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dfrnt 0.2
File Size Uploaded Provenance
dfrnt-0.2.tar.gz 3.1 kB Without provenance Details

Release files / dfrnt-0.2.tar.gz

Download URL dfrnt-0.2.tar.gz
Size 3.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8c9eb53c3ef63794a324f4679e6ea1c6e961cfadeb619fa70fbd7794bc3b07e0
BLAKE2b-256 checksum
How to use checksums
40f053587ec8fd46da4e0d94bdc05f6154abbbbd6ee163a2d2005269c3a60028
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for dfrnt 0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page