Skip to content

Commit 30bcf91

Browse files
Johannes Sixtj6t
authored andcommitted
imgdiff: Be prepared for new and deleted images.
Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
1 parent 0f3936b commit 30bcf91

1 file changed

Lines changed: 24 additions & 6 deletions

File tree

contrib/imgdiff/imgdiff

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,36 @@
11
#!/bin/sh
22

3+
d=$TMP/imgdiff$$.png
4+
5+
trap 'rm -f "$d"' 0 1 2 15
6+
37
if test $# = 7; then
48
of="$2"
59
nf="$5"
6-
echo "Image $1 changed"
10+
case $3:$6 in
11+
.:*)
12+
echo "New image $1"
13+
imdisplay "$nf"
14+
exit
15+
;;
16+
*:.)
17+
echo "Deleted image $1"
18+
convert -size 140x80 xc:none -fill red \
19+
-gravity NorthWest -draw "text 10,10 'Deleted'" \
20+
-gravity SouthEast -draw "text 5,15 'Deleted'" \
21+
miff:- | \
22+
composite -tile - "$of" "$d" &&
23+
imdisplay "$d"
24+
exit
25+
;;
26+
*)
27+
echo "Image $1 changed"
28+
esac
729
else
830
of="$1"
931
nf="$2"
1032
echo "Images $of and $nf differ"
1133
fi
1234

13-
d=$TMP/imgdiff$$.png
14-
15-
trap 'rm -f "$d"' 0 1 2 15
16-
17-
compare "$of" "$nf" "$d" &&
35+
compare -virtual-pixel black "$of" "$nf" "$d" &&
1836
imdisplay "$d"

0 commit comments

Comments
 (0)