GithubHelp home page GithubHelp logo

daviddta / git-diff-image.fork Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ewanmellor/git-diff-image

0.0 0.0 0.0 316 KB

An extension to 'git diff' that provides support for diffing images.

Shell 100.00%

git-diff-image.fork's Introduction

git-diff-image

This is an extension to 'git diff' that provides support for diffing images. It can also be run as a direct CLI command for diffing two image files.

Platforms

Only macOS and Linux at the moment. Patches welcome!

Examples

$ git diff
--- a/anImageThatHasChanged.jpg
+++ b/anImageThatHasChanged.jpg
@@ -1,5 +1,5 @@
 ExifTool Version Number         : 9.76
-File Size                       : 133 kB
+File Size                       : 54 kB
 File Access Date/Time           : 2015:05:02 20:01:21-07:00
 File Type                       : JPEG
 MIME Type                       : image/jpeg

$ git diff-image
# The same output as above, *and* a montage of the visual differences will be
# generated and opened in Preview.

$ diff-image anImageThatHasChanged1.jpg anImageThatHasChanged2.jpg
# The same as above, only using files on disk not git differences.

Screenshot

Installation

  1. Install exiftool and either ImageMagick or GraphicsMagick with the ImageMagick compatibility links. (The script will cope with these missing, but it's not going to be very exciting without them).

    macOS:

    brew install exiftool imagemagick

    Debian / Ubuntu (new versions):

    sudo apt install exiftool imagemagick xdg-utils

    Debian / Ubuntu (older versions):

    sudo apt install exiftool imagemagick xdg-open

    Debian / Ubuntu (if using GraphicsMagick):

    sudo apt install exiftool graphicsmagick graphicsmagick-imagemagick-compat xdg-utils

    Arch Linux:

    pacman -S xdg-utils perl-image-exiftool imagemagick xorg-xdpyinfo

    openSUSE Tumbleweed:

    sudo zypper install exiftool ImageMagick xdg-utils bc
  2. Run ./install.sh, which will configure your global git config for you. It will tell you what it's done, so it should look something like this:

~/git-diff-image $ ./install.sh
+ git config --global core.attributesfile '~/.gitattributes'
+ touch '/Users/yourname/.gitattributes'
+ echo '*.gif diff=image' >>'/Users/yourname/.gitattributes'
+ echo '*.jpeg diff=image' >>'/Users/yourname/.gitattributes'
+ echo '*.jpg diff=image' >>'/Users/yourname/.gitattributes'
+ echo '*.png diff=image' >>'/Users/yourname/.gitattributes'
+ git config --global alias.diff-image '!f() { cd -- "${GIT_PREFIX:-.}"; GIT_DIFF_IMAGE_ENABLED=1 git diff "$@"; }; f'
+ git config --global diff.image.command '~/git-diff-image/git_diff_image'

Git LFS

If you are using Git LFS then you have some extra manual configuration. This has been left as a manual step because you need to choose whether to do this on a per-repository basis or set it in your global configuration.

Instead of the default configuration in ~/.gitattributes which looks like this:

*.png diff=image

You need to extend it to look something like this:

*.png filter=lfs diff=lfs diff=image merge=lfs -text

You can either do this in your ~/.gitattributes or a .gitattributes file at the root of each repository.

Public domain dedication

The files in this repository are by Ewan Mellor, and are dedicated to the public domain. To the extent possible under law, Ewan Mellor has waived all copyright and related or neighboring rights to this work. http://creativecommons.org/publicdomain/zero/1.0/.

git-diff-image.fork's People

Contributors

ewanmellor avatar hannesa2 avatar eyal0 avatar icecoffin avatar franciscod avatar gogoprog avatar glebm avatar jochendiekenbrock avatar ottok avatar asfaltboy avatar pkess avatar sm11963 avatar neojski avatar lorenzbischof avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.