Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Core services used by diffux/diffux
Ruby JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.


Gem Version Build Status Code Climate Coverage

Core services used by diffux/diffux.


Command-line tools

diffux-core comes with a couple of useful command-line tools.


Take a snapshot of a URL and save as a PNG image.


Take a snapshot of in a 1200 pixel wide window and save as "google.png":

diffux-snapshot --url \
                --outfile google.png -- \
                --width 1200

Take a snapshot of in a 320 pixel wide window, use a custom user-agent header, and save as "google-mobile.png":

diffux-snapshot --url \
                --outfile google-mobile.png -- \
                --width 320 \
                --useragent "c3p0 (Netscape compatible)"

You can limit the area that the snapshot image is taken for by providing a cropselector option:

diffux-snapshot --url \
                --outfile yahoo.png -- \
                --cropselector ".searchwrapper"

In this example, if no element is found with a searchwrapper class on the page, the crop selector will be ignored and the snapshot will contain the entire page.

If more than one element matches the crop selector, only the first one will be included in the snapshot image.


Compare two snapshots (or any images for that matter) and outputs a diff if the two images are different.


Compare a previously snapshotted image with a new version:

diffux-compare --before-image google1.png \
               --after-image google2.png

If a diff is detected, a diff.png file is saved in the current folder. This file is a side-by-side line-up of the before and after image with a diff representation in the middle. The script will also exit with a non-zero exit code.

If there is no diff between the before and after image, the program will silently exit with no output. The exit code in this case is zero.

You can override the output file if you want to:

diffux-compare --before-image google1.png \
               --after-image google2.png \
               --outfile diff.png

Here's an example of a diff.png output from diffux-compare:

Example of a Diffux diff

Something went wrong with that request. Please try again.