├── doc ├── example-font.png ├── spot-the-diff-lhs.png ├── spot-the-diff-montage.png ├── spot-the-diff-original.png └── spot-the-diff-rhs.png ├── git-diff-img ├── license.text └── readme.md /doc/example-font.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niedzielski/git-diff-img/43652b37af4adb7758a5fd54522dfb8d9064dac3/doc/example-font.png -------------------------------------------------------------------------------- /doc/spot-the-diff-lhs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niedzielski/git-diff-img/43652b37af4adb7758a5fd54522dfb8d9064dac3/doc/spot-the-diff-lhs.png -------------------------------------------------------------------------------- /doc/spot-the-diff-montage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niedzielski/git-diff-img/43652b37af4adb7758a5fd54522dfb8d9064dac3/doc/spot-the-diff-montage.png -------------------------------------------------------------------------------- /doc/spot-the-diff-original.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niedzielski/git-diff-img/43652b37af4adb7758a5fd54522dfb8d9064dac3/doc/spot-the-diff-original.png -------------------------------------------------------------------------------- /doc/spot-the-diff-rhs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/niedzielski/git-diff-img/43652b37af4adb7758a5fd54522dfb8d9064dac3/doc/spot-the-diff-rhs.png -------------------------------------------------------------------------------- /git-diff-img: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # $@ images 3 | exec git difftool -x ' 4 | compare -alpha copy "$LOCAL" "$REMOTE" png:- | 5 | montage -mode concatenate "$LOCAL" png:- "$REMOTE" png:- | 6 | display -title "$BASE: Local | Diff | Remote" png:- 7 | ' "$@" 8 | -------------------------------------------------------------------------------- /license.text: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # git-diff-img 2 | 3 | ![Example difference after replacing the left hand side with the right](doc/spot-the-diff-montage.png) 4 | The result of `git diff-img`. Sample image by 5 | [Muband](https://ja.wikipedia.org/wiki/%E5%88%A9%E7%94%A8%E8%80%85:Muband) from 6 | the [Spot the difference](https://en.wikipedia.org/wiki/Spot_the_difference) 7 | Wikipedia article; distributed under a CC BY-SA 3.0 license 8 | 9 | ## Installation 10 | 11 | ### System Prerequisites 12 | Install ImageMagick: `sudo apt install imagemagick`. 13 | 14 | ### As a Git configuration (**recommended**) 15 | 16 | ```bash 17 | 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:-'\' 18 | ``` 19 | 20 | ### As an executable (**not** recommended) 21 | 22 | This is an *alternative* installation procedure that is unnecessary if the Git 23 | configuration is used. It's not recommended because it requires an understanding 24 | of PATH lookup 25 | 26 | ```bash 27 | curl https://raw.githubusercontent.com/niedzielski/git-diff-img/master/git-diff-img -o ~/bin/git-diff-img && 28 | chmod +x ~/bin/git-diff-img 29 | ``` 30 | 31 | ## Usage 32 | Execute against images only: `git diff-img **.png` 33 | 34 | ## Tips 35 | 36 |
37 | 💡 Resizing the diff to fit your monitor… 38 | 39 | Newer versions of ImageMagick support resizing the diff to fit large images to 40 | the screen. Consider adding 41 | [the `-resize` argument](https://imagemagick.org/script/command-line-options.php#resize) 42 | to `display` if you want this behavior. Eg, instead of: 43 | 44 | ``` 45 | display -title "$BASE: Local | Diff | Remote" png:- 46 | ``` 47 | 48 | Try: 49 | 50 | ``` 51 | display -resize 1900x -title "$BASE: Local | Diff | Remote" png:- 52 | ``` 53 |
54 | 55 | ## Examples 56 | ![The percentage symbol differs](doc/example-font.png) 57 | _Version a [font](https://rndmem.com) sprite sheet and see the concrete difference in each commit._ 58 | 59 | ## Links 60 | - [delta](https://github.com/dandavison/delta) 61 | - [diff-so-fancy](https://github.com/so-fancy/diff-so-fancy) 62 | - [Improved Colored Diff](https://github.com/jeffkaufman/icdiff) 63 | 64 | ## License (Public Domain) 65 | All code is public domain and may be used without limitation. 66 | --------------------------------------------------------------------------------