图片对比工具-imgdiff

imgdiff是一款开源的图像差异对比工具。基于Go语言编写,遵守MIT开源协议。图片格式包括格式包括:.png, .jpg, .jpeg, .bmp, .tiff, .xpm .等。


用法:

 imgdiff [--threshold THRESHOLD] [--diff-image] [--fail-on-layout] BASE COMPARE OUTPUT

名称:
  BASE                   基本图片.
  COMPARE                要比较的图片.
  OUTPUT                 输出路径.

Options:
  --threshold THRESHOLD, -t THRESHOLD
                        颜色阈值 (from 0 to 1). 减少精准度. [default: 0.1]
  --diff-image          渲染图片差异为透明背景. [default: false]
  --fail-on-layout      如果布局不同不要比较 [default: false]
  --help, -h             展示这个帮助和退出

https://github.com/n7olkachev/imgdiff

----------------------------------------------------

图片对比工具-ODIFF

ODIFF是一款像素级图像对比开源工具。遵守MIT开源协议。速度极快,支持对比大体积图片。


功能特色:
    white_check_mark 支持图片格式包括:.png, .jpg, .jpeg, .bmp, .tiff, .xpm .
    white_check_mark 跨格式对比- 例如 .jpg 和 .png 对比.
    white_check_mark 支持不同图层的对比图Supports comparison of images with different layouts.
    white_check_mark 使用 YIQ NTSC transmission 算法(http://www.progmat.uaem.mx:8080/artVol2Num2/Articulo3Vol2Num2.pdf)对比视觉差异.

基本使用方法:
odiff <IMG1 path> <IMG2 path> <DIFF output path>

命令行帮助:
odiff --help

https://github.com/dmtrKovalenko/odiff

-----------------------------------------------------

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

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

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 6 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.

from 

https://github.com/dmtrKovalenko/odiff