Skip to content

niedzielski/git-diff-img

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

git-diff-img

Example difference after replacing the left hand side with the right The result of git diff-img. Sample image by Muband from the Spot the difference Wikipedia article; distributed under a CC BY-SA 3.0 license

Installation

System Prerequisites

Install ImageMagick: sudo apt install imagemagick.

As a Git configuration (recommended)

git config --global alias.diff-img difftool\ -x\ \''compare -alpha copy "$LOCAL" "$REMOTE" png:- | montage -mode concatenate "$LOCAL" png:- "$REMOTE" png:- | display -title "$BASE: Local | Diff | Remote" png:-'\'

As an executable (not recommended)

This is an alternative installation procedure that is unnecessary if the Git configuration is used. It's not recommended because it requires an understanding of PATH lookup

curl https://raw.githubusercontent.com/niedzielski/git-diff-img/master/git-diff-img -o ~/bin/git-diff-img &&
chmod +x ~/bin/git-diff-img

Usage

Execute against images only: git diff-img **.png

Tips

💡 Resizing the diff to fit your monitor…

Newer versions of ImageMagick support resizing the diff to fit large images to the screen. Consider adding the -resize argument to display if you want this behavior. Eg, instead of:

display -title "$BASE: Local | Diff | Remote" png:-

Try:

display -resize 1900x -title "$BASE: Local | Diff | Remote" png:-

Examples

The percentage symbol differs Version a font sprite sheet and see the concrete difference in each commit.

Links

License (Public Domain)

All code is public domain and may be used without limitation.