Skip to content

Instantly share code, notes, and snippets.

@grigorye
Created April 29, 2020 15:32
Show Gist options
  • Save grigorye/f9bbf7f1393a5e50f77f26af8a714d70 to your computer and use it in GitHub Desktop.
Save grigorye/f9bbf7f1393a5e50f77f26af8a714d70 to your computer and use it in GitHub Desktop.
Poor man's image comparator (suitable for integration with Git clients)
#! /bin/sh
set -euo pipefail
tmpdir=$(mktemp -d "/tmp/$(basename "$0").XXXXX")
bn1=$(basename "$1")
bn2=$(basename "$2")
diff="$tmpdir/diff-$bn1-$bn2.png"
~/homebrew/bin/magick compare "$1" "$2" -compose src "$diff" && true
open "$diff" "$1" "$2"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment