Coder Social home page Coder Social logo

diffux-core's Introduction

diffux-core

Gem Version Build Status Code Climate Coverage

Core services used by diffux/diffux.

Documentation

Command-line tools

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

diffux-snapshot

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

Example

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

diffux-snapshot --url http://www.google.com \
                --outfile google.png -- \
                --width 1200

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

diffux-snapshot --url http://www.google.com \
                --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 http://www.yahoo.com \
                --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.

diffux-compare

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

Example

Compare a previously snapshotted google.com 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

diffux-core's People

Contributors

lencioni avatar

Watchers

Regis A. Despres avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.