#compare #diff #image #change #assert #nodejs

bin+lib dify

A fast pixel-by-pixel image comparison tool in Rust

10 releases

0.7.4 Oct 4, 2024
0.7.3 Oct 4, 2024
0.6.0 Jan 28, 2023
0.5.1 Aug 6, 2022
0.3.6-alpha.0 Mar 20, 2021

#73 in Images

Download history 10/week @ 2024-08-19 5/week @ 2024-08-26 2/week @ 2024-09-02 9/week @ 2024-09-09 8/week @ 2024-09-16 207/week @ 2024-09-23 708/week @ 2024-09-30 761/week @ 2024-10-07 74/week @ 2024-10-14 1025/week @ 2024-10-21 2697/week @ 2024-10-28 1108/week @ 2024-11-04 768/week @ 2024-11-11 678/week @ 2024-11-18 1733/week @ 2024-11-25 3946/week @ 2024-12-02

7,347 downloads per month

MIT license

33KB
667 lines

Dify Logo

Dify

A fast pixel-by-pixel image comparison tool in Rust

Workflows - CI crates.io version crates.io license crates.io downloads docs.rs

Features

Feature
.png, .jpg, .jpeg, or .bmp format supported
Compares different format, .png vs .jpg for example
Compares different dimensions
Anti-aliasing support
Blockout areas support
Supports macOS, Linux and Windows

Demo

expected actual diff
expected actual diff

The expected and actual image are coming from mapbox/pixelmatch

Getting Started

Installation

From binaries

Download the binaries for your platform from release page.

Node.js ecosystem

Please refer to dify-bin npm package, it is a node.js wrapper for dify executable file:

npm install -g dify-bin # or `yarn global add dify-bin`
dify --help

Usage

dify left.jpg right.jpg

Checkout diff.png if a.jpg and b.jpg are different.

For more details, see dify --help.

Docker

docker run -v $(pwd):/mnt/dify ghcr.io/jihchi/dify left.jpg right.jpg

Benchmarks

Test data is coming from mtrKovalenko/odiff

hyperfine \
  --warmup 1 \
  --ignore-failure \
  --export-markdown bench-dify.md \
  'dify tiger.jpg tiger-2.jpg -o tiger-diff.png' \
  'dify water-4k.png water-4k-2.png -o water-diff.png' \
  'dify www.cypress.io.png www.cypress.io-2.png -o www.cypress.io-diff.png'
Command Mean [ms] Min [ms] Max [ms] Relative
dify tiger.jpg tiger-2.jpg -o tiger-diff.png 40.2 ± 0.4 39.6 42.3 1.00
dify water-4k.png water-4k-2.png -o water-diff.png 1754.9 ± 23.3 1716.2 1799.6 43.68 ± 0.74
dify www.cypress.io.png www.cypress.io-2.png -o www.cypress.io-diff.png 1228.0 ± 17.6 1203.6 1251.7 30.56 ± 0.54

Ran on MacBook Pro (13-inch, 2019, Two Thunderbolt 3 ports), macOS Catalina 10.15.7.

Roadmap

See the open issues for a list of proposed features (and known issues).

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Acknowledgements

Contributors

Many thanks for your help!

The image of contributors is made with contrib.rocks.

Dependencies

~4–14MB
~117K SLoC