CLI tool for comparing images
Install this tool using pip:
$ pip install image-diff To generate an image showing the difference between two images:
image-diff first.jpg second.jpg -o diff.png To count the number of pixels that have changed, use image-diff count:
image-diff first.jpg second.jpg This will output a number followed by a newline.
The image-diff compile command exists mainly to make this tool easier to test.
It can be used to compile an image from a JSON definition - for example:
echo '[ [[0, 0, 0], [0, 0, 0], [0, 0, 0]], [[0, 0, 0], [255, 0, 0], [0, 0, 0]], [[0, 0, 0], [0, 0, 0], [0, 0, 0]] ]' | image-diff compile - -o one-pixel.png - pixelmatch by Mapbox is a JavaScript library with an accompanying CLI tool.
To contribute to this tool, first checkout the code. Then create a new virtual environment:
cd image-diff python -m venv venv source venv/bin/activate Or if you are using pipenv:
pipenv shell Now install the dependencies and test dependencies:
pip install -e '.[test]' To run the tests:
pytest