Skip to content

Commit 0f3936b

Browse files
Johannes Sixtj6t
authored andcommitted
imgdiff: A diff driver that highlights differences in images.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
1 parent f34be46 commit 0f3936b

2 files changed

Lines changed: 53 additions & 0 deletions

File tree

contrib/imgdiff/README

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
This directory contains facilities that allow to highlight changes
2+
between two images.
3+
4+
Prerequisites
5+
-------------
6+
7+
ImageMagick - http://www.imagemagick.org/script/download.php
8+
9+
10+
Installation
11+
------------
12+
13+
Copy the file imgdiff into a directory that is in your PATH
14+
15+
16+
Usage
17+
-----
18+
19+
Activate imgdiff in your repository
20+
21+
a. Define a custom diff driver:
22+
23+
$ git config diff.imgdiff.command imgdiff
24+
25+
b. Use the custom driver for your images, i.e. put
26+
a line like this in your .git/info/attributes:
27+
28+
*.png diff=imgdiff
29+
30+
Since this uses ImageMagick behind the scenes, all image formats
31+
are supported that your ImageMagick installation supports.
32+
33+
You can also run the program from the command line like this:
34+
35+
$ imgdiff pictureold.png picturenew.png

contrib/imgdiff/imgdiff

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/sh
2+
3+
if test $# = 7; then
4+
of="$2"
5+
nf="$5"
6+
echo "Image $1 changed"
7+
else
8+
of="$1"
9+
nf="$2"
10+
echo "Images $of and $nf differ"
11+
fi
12+
13+
d=$TMP/imgdiff$$.png
14+
15+
trap 'rm -f "$d"' 0 1 2 15
16+
17+
compare "$of" "$nf" "$d" &&
18+
imdisplay "$d"

0 commit comments

Comments
 (0)