Last active
November 4, 2016 08:44
-
-
Save cpelley/63c3b17e6b3ff7514d5430f9119b9992 to your computer and use it in GitHub Desktop.
Commandline image diff utility
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Function to diff an image using imagemagick, displaying the original images | |
| # and the diff. | |
| # | |
| # Add this file to your PATH to make available and ensure that it has | |
| # executable privileges. | |
| # | |
| # Example usage: | |
| # imgdiff <image1> <image2> | |
| # http://askubuntu.com/questions/209517/does-diff-exist-for-images | |
| compare -compose src $1 $2 tmp_difference.png | |
| convert +append $1 $2 tmp_difference.png tmp_difference_comb.png | |
| display tmp_difference_comb.png | |
| shift && shift | |
| case $* in | |
| --delete|-d) | |
| echo 'Cleaning up diff images.' | |
| rm -f tmp_difference.png tmp_difference_comb.png | |
| ;; | |
| *) | |
| echo 'Unrecognised command: '$* | |
| ;; | |
| esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment