All Projects → dmtrKovalenko → Odiff

dmtrKovalenko / Odiff

Licence: mit
The fastest pixel-by-pixel image visual difference tool in the world.

Programming Languages

reason
219 projects

Projects that are alternatives of or similar to Odiff

dify
A fast pixel-by-pixel image comparison tool in Rust
Stars: ✭ 41 (-96.5%)
Mutual labels:  diff, visual, snapshot
reducer-tester
Utilities for testing redux reducers
Stars: ✭ 19 (-98.38%)
Mutual labels:  diff, snapshot
Sirix
SirixDB is a temporal, evolutionary database system, which uses an accumulate only approach. It keeps the full history of each resource. Every commit stores a space-efficient snapshot through structural sharing. It is log-structured and never overwrites data. SirixDB uses a novel page-level versioning approach called sliding snapshot.
Stars: ✭ 638 (-45.61%)
Mutual labels:  snapshot, diff
Deepdiff
Deep Difference and search of any Python object/data.
Stars: ✭ 985 (-16.03%)
Mutual labels:  diff
Scarab
A system to patch your content files.
Stars: ✭ 38 (-96.76%)
Mutual labels:  diff
Backintime
Back In Time - A simple backup tool for Linux
Stars: ✭ 1,066 (-9.12%)
Mutual labels:  snapshot
Abide
📸 A Go testing utility for http response snapshots.
Stars: ✭ 71 (-93.95%)
Mutual labels:  snapshot
Documents
Documentation for Phase 4 Ground
Stars: ✭ 31 (-97.36%)
Mutual labels:  visual
Python Patch
Library to parse and apply unified diffs
Stars: ✭ 65 (-94.46%)
Mutual labels:  diff
Sketch
A Common Lisp framework for the creation of electronic art, visual design, game prototyping, game making, computer graphics, exploration of human-computer interaction, and more.
Stars: ✭ 1,026 (-12.53%)
Mutual labels:  visual
Moosefs
MooseFS – Open Source, Petabyte, Fault-Tolerant, Highly Performing, Scalable Network Distributed File System (Software-Defined Storage)
Stars: ✭ 1,025 (-12.62%)
Mutual labels:  snapshot
Jsdom Screenshot
📸 Take screenshots of jsdom with puppeteer
Stars: ✭ 39 (-96.68%)
Mutual labels:  snapshot
Vscode Smoothtype
VS Code extension to add cursor transitions while typing, similar to MS Office and the Windows 10 Mail app.
Stars: ✭ 54 (-95.4%)
Mutual labels:  visual
Big Album Art
[RETIRED] A Flask app to display almost-fullscreen album art for your currently playing Spotify songs. Enjoy the visuals!
Stars: ✭ 38 (-96.76%)
Mutual labels:  visual
Ui
Web UI for CodeceptJS
Stars: ✭ 65 (-94.46%)
Mutual labels:  visual
Delta
A syntax-highlighting pager for git, diff, and grep output
Stars: ✭ 11,555 (+885.08%)
Mutual labels:  diff
Garbevents
This is a python toolkit for real-time capture, analysis, cleaning and report generation of embedded points based on the development of mitmproxy.
Stars: ✭ 62 (-94.71%)
Mutual labels:  diff
Pretty Time
Easily format the time from node.js `process.hrtime`. Works with timescales ranging from weeks to nanoseconds.
Stars: ✭ 44 (-96.25%)
Mutual labels:  diff
Jsx Lite
Write components once, run everywhere. Compiles to Vue, React, Solid, Angular, Svelte, and Liquid.
Stars: ✭ 1,015 (-13.47%)
Mutual labels:  visual
Xible
Visualize your workflow
Stars: ✭ 49 (-95.82%)
Mutual labels:  visual

ODIFF

The fastest* (one-thread) pixel-by-pixel image difference tool in the world.

made with reason npm

Why Odiff?

ODiff is a blazing fast native image comparison tool. Check benchmarks for the results, but it compares the visual difference between 2 images in milliseconds. It was originally designed to handle the "big" images. Thanks to Ocaml and its speedy and predictable compiler we can significantly speed up your CI pipeline.

Demo

base comparison diff
1diff
1diff
1diff

Features

  • ✅ .png, .jpg, .jpeg, .bmp, .tiff, .xpm – Files supported.
  • ✅ Cross-format comparison - Yes .jpg vs .png comparison without any problems.
  • ✅ Supports comparison of images with different layouts.
  • ✅ Using YIQ NTSC transmission algorithm to determine visual difference.
  • ✅ No dependencies for .png comparison. Only several system C dependencies for other formats, more info.

Coming in the nearest future:

  • ⏹ Ignoring regions
  • ⏹ Anti-aliasing support
  • ⏹ Remote images compare

Usage

Basic comparison

Run the simple comparison. Image paths can be one of supported formats, diff output can only be .png.

odiff <IMG1 path> <IMG2 path> <DIFF output path>

Node.js

We also provides direct node.js binding for the odiff. Run the odiff from nodejs:

const { compare } = require("odiff-bin");

const { match, reason } = await compare(
  "path/to/first/image.png",
  "path/to/second/image.png",
  "path/to/diff.png"
);

Api

Here is an api reference:

CLI

The best way to get up-to-date cli interface is just to type the

odiff --help

Node.js

NodeJS Api is pretty tiny as well. Here is a typescript interface we have:

type ODiffOptions = {
  /** Output only changed pixels over transparent background. */
  outputDiffMask: boolean;
  /** Do not compare images and produce output if images layout is different. */
  failOnLayoutDiff: boolean;
  /** Color difference threshold (from 0 to 1). Less more precise. */
  threshold: number;
};

declare function compare(
  basePath: string,
  comparePath: string,
  diffPath: string,
  options?: ODiffOptions
): Promise<
  { match: true } | { match: false; reason: "layout-diff" | "pixel-diff" }
>;

Compare option will return { match: true } if images are identical. Otherwise return { match: false, reason: "*" } with a reason why images were different.

Make sure that diff output file will be created only if images have pixel difference we can see 👀

Installation

We provide prebuilt binaries for most of the used platforms, there are a few ways to install them:

Cross-platform

The recommended and cross-platform way to install this lib is npm and node.js. Make sure that this package is compiled directly to the platform binary executable, so the npm package contains all binaries and post-install script will automatically link the right one for the current platform.

Important: package name is odiff-bin. But the binary itself is odiff

npm install odiff-bin

Then give it a try 👀

odiff --help

lib* dependencies

Make sure if you want to compare other than .png images it is required to install the proper C library for each format. For .jpg – libjpg, for .tifflibtiff, for .xpm - libxpm.

.png images works out of the box.

MacOS

⛔️ Doesn't work. Waiting for brew approve ⛔️

brew install odiff

Alpine Linux

apk add odiff

From binaries

Download the binaries for your platform from release page.

Benchmarks

Run the benchmarks by yourself. Instructions of how to run the benchmark is here

benchmark

Performance matters. At least for sort of tasks like visual regression. For example, if you are running 25000 image snapshots per month you can save 20 hours of CI time per month by speeding up comparison time in just 3 seconds per snapshot.

3s * 25000 / 3600 = 20,83333 hours

Here is odiff performance comparison with other popular visual difference solutions. We are going to compare some real-world use cases.

Lets compare 2 screenshots of full-size https://cypress.io page:

Command Mean [s] Min [s] Max [s] Relative
pixelmatch www.cypress.io-1.png www.cypress.io.png www.cypress-diff.png 7.712 ± 0.069 7.664 7.896 6.67 ± 0.03
ImageMagick compare www.cypress.io-1.png www.cypress.io.png -compose src diff-magick.png 8.881 ± 0.121 8.692 9.066 7.65 ± 0.04
odiff www.cypress.io-1.png www.cypress.io.png www.cypress-diff.png 1.168 ± 0.008 1.157 1.185 1.00

Wow. Odiff is mostly 2 times faster than imagemagick and pixelmatch. And this will be even clearer if image will become larger. Lets compare an 8k image to find a difference with another 8k image:

Command Mean [s] Min [s] Max [s] Relative
pixelmatch water-4k.png water-4k-2.png water-diff.png 10.614 ± 0.162 10.398 10.910 5.50 ± 0.05
Imagemagick compare water-4k.png water-4k-2.png -compose src water-diff.png 9.326 ± 0.436 8.819 10.394 5.24 ± 0.10
odiff water-4k.png water-4k-2.png water-diff.png 1.951 ± 0.014 1.936 1.981 1.00

Yes it is significant improvement. And the produced difference will be the same for all 3 commands.

Changelog

If you have recently updated, please read the changelog for details of what has changed.

License

The project is licensed under the terms of MIT license

Thanks

This project was highly inspired by pixelmatch and imagemagick.

Support the project

...one day a donation button will appear here. But for now you can follow author's twitter :)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].