- Download zlib and build it with
./configure
andmake
. - Download pngcheck.
- Make sure that the zlib directory is called
zlib
and is a sibling of of thepngcheck
directory. - Build
pngcheck
withmake -f Makefile.unx
. - Put
pngcheck
somewhere in your path. - Create a
pngdiff
shell script somewhere in your path:#!/bin/bash LOCAL_FILE=`mktemp /tmp/pngdiff.local.XXXXXX` || exit 1 pngcheck -v $1 > $LOCAL_FILE REMOTE_FILE=`mktemp /tmp/pngdiff.remote.XXXXXX` || exit 1 pngcheck -v $2 > $REMOTE_FILE bbdiff --wait --resume $LOCAL_FILE $REMOTE_FILE
(replacingbbdiff
with your preferred text diffing tool) - Add the following lines to
~/.gitconfig
:[difftool "pngdiff"] cmd = pngdiff "$REMOTE" "$LOCAL"
- Run
git difftool -t pngdiff
to view diffs.
Relatedly, to view diffs of images in Preview.app
(using the up/down arrows to toggle between the old and new versions), add this to ~/.gitconfig
:
[difftool "imagediff"] cmd = open -n -W -a preview "$REMOTE" "$LOCAL"