Code Monkey home page Code Monkey logo

git-diff-image's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

git-diff-image's Issues

Fails when trying to open an image generated by iphone simulator under xcode

Trying to compare the two files attached, I get this error. For that matter the browser doesn't want to open the one created in xcode either, but Preview.app has no trouble with it.

Warning: Non-standard PNG image (Apple iPhone format) - imagetest/image.new.png
compare: CgBI: unhandled critical chunk `imagetest/image.new.png' @ error/png.c/MagickPNGErrorHandler/1492.


% ./diff-image imagetest/* --- imagetest/image.new.png +++ imagetest/image.old.png @@ -1,19 +1,14 @@ Apple Data Offsets : (Binary data 28 bytes, use -b option to extract) Bit Depth : 8 -Blue X : 0.15 -Blue Y : 0.06 Color Space : sRGB -Color Type : RGB with Alpha +Color Type : RGB Compression : Deflate/Inflate Exif Byte Order : Big-endian (Motorola, MM) Exif Image Height : 1136 Exif Image Width : 640 -File Size : 62 kB +File Size : 68 kB File Type : PNG Filter : Adaptive -Gamma : 2.2 -Green X : 0.3 -Green Y : 0.6 Image Height : 1136 Image Size : 640x1136 Image Width : 640 @@ -23,12 +18,7 @@ Pixel Units : meters Pixels Per Unit X : 5669 Pixels Per Unit Y : 5669 -Red X : 0.64 -Red Y : 0.33 Resolution Unit : inches SRGB Rendering : Perceptual -Warning : Non-standard PNG image (Apple iPhone format) -White Point X : 0.3127 -White Point Y : 0.329 X Resolution : 144 Y Resolution : 144 Warning: Non-standard PNG image (Apple iPhone format) - imagetest/image.new.png compare: CgBI: unhandled critical chunk imagetest/image.new.png' @ error/png.c/MagickPNGErrorHandler/1492.
phillipapley@AGPAPLEYMBP git-diff-image % ./diff-image imagetest/*
--- imagetest/image.new.png
+++ imagetest/image.old.png
@@ -1,19 +1,14 @@
Apple Data Offsets : (Binary data 28 bytes, use -b option to extract)
Bit Depth : 8
-Blue X : 0.15
-Blue Y : 0.06
Color Space : sRGB
-Color Type : RGB with Alpha
+Color Type : RGB
Compression : Deflate/Inflate
Exif Byte Order : Big-endian (Motorola, MM)
Exif Image Height : 1136
Exif Image Width : 640
-File Size : 62 kB
+File Size : 68 kB
File Type : PNG
Filter : Adaptive
-Gamma : 2.2
-Green X : 0.3
-Green Y : 0.6
Image Height : 1136
Image Size : 640x1136
Image Width : 640
@@ -23,12 +18,7 @@
Pixel Units : meters
Pixels Per Unit X : 5669
Pixels Per Unit Y : 5669
-Red X : 0.64
-Red Y : 0.33
Resolution Unit : inches
SRGB Rendering : Perceptual
-Warning : Non-standard PNG image (Apple iPhone format)
-White Point X : 0.3127
-White Point Y : 0.329
X Resolution : 144
Y Resolution : 144
Warning: Non-standard PNG image (Apple iPhone format) - imagetest/image.new.png
compare: CgBI: unhandled critical chunk imagetest/image.new.png' @ error/png.c/MagickPNGErrorHandler/1492. <img width="320" alt="image new" src="https://user-images.githubusercontent.com/1513087/228022588-71782af5-4128-4809-bafc-56910a9c9912.png"> <img width="320" alt="image old" src="https://user-images.githubusercontent.com/1513087/228022592-faaec709-cfda-461e-8d2a-82bf440a4a93.png">

Path with spaces causes error on MacOS


$> git diff
/Volumes
.
.
Data/Users/user_dir/GitHub/git-diff-image/git_diff_image: /Volumes: is a directory
/Volumes
.
.
Data/Users/user_dir/GitHub/git-diff-image/git_diff_image: line 1: .: filename argument required
.: usage: . filename [arguments]
fatal: external diff died, stopping at features/login/screenshots/de-DE_login_idle.png

The project dir
/Volumes/Macintosh HD - Data/Users/user_dir/GitHub/project

silent error with wide images

git-diff-image silently fails with wide images.
By doing this change:

diff --git a/diff-image b/diff-image
index 1da14a4..0dbcfdb 100755
--- a/diff-image
+++ b/diff-image
@@ -195,7 +195,7 @@ density_flag=
 do_compare()
 {
     compare $density_flag $color_flag $fuzz_flag $backgroundcolor_flag "$f1" "$f2" png:- | \
-        montage $density_flag -geometry +4+4 $backgroundcolor_flag "$f1" - "$f2" png:- >"$destfile" 2>/dev/null || true
+        montage $density_flag -geometry +4+4 $backgroundcolor_flag "$f1" - "$f2" png:- >"$destfile"
 }

 if which xdg-open > /dev/null

compare throws this error:

montage-im6.q16: width or height exceeds limit `png:-' @ error/cache.c/OpenPixelCache/3909.

Please allow larger images, and consider some sort of error reporting.

Public domain dedication not the same as CC0

Hey.
Thanks for a cool project.
I noticed that you put a public domain dedication on the bottom of the readme and then link to CC0. These two things are not the same. "public domain" is a concept in US law, and for example in Germany, it's not possible to dedicate anything to the public domain. CC0 takes this into account and creates a legal framework that works in many countries, not only the US. So I'd recommend saying more explicitly it's licensed under CC0, not that it's public domain, even though the two are equivalent in the US.

Cheers,
Andy

How to revert the git changes

After running the ./install.sh, the script makes the changes to the git files.
Is there a way to revert the changes made by the script?

Trying to create a binary patch file

When trying to create a path file like git diff master myfeature --binary > mypatch.patch having diff.image.command set to git-diff-image makes the patch fail since it still uses the text description provided by git_diff_image.

Is there a way to handle the --binary flag and disable the custom image diff? Or maybe an simple way (behind and alias) to enable/disable the custom image diff.

alignment of images

Am I correct that the diff tends to center the two images relative to each other? E.g., I had two images that were identical except that the second one had some extra content at the bottom (making it taller overall), you'd end up centering the images during the diff meaning that everything would show in red since the second image is now shifted relative to the first?

It might be nice to be able to specify the alignment of images to handle these cases.

ubuntu 20.04 xdg-open package

Starting with Ubuntu 20.04 xdg-open is available in package xdg-utils.
So the dependencies install line becomes: sudo apt install exiftool imagemagick xdg-utils

GraphicMagick as alternative dependency?

Does git-diff-image use any features that are ImageMagick specific, or does it work with GraphicMagic as well?

If anybody has already tested it and has knowledge, please note results in this issue.

If not, let's keep the issue open until GraphicsMagic compatibility is documented.

Show git-diff-image output also on 'git show' and 'git log -p'?

Is this diff tool designed to work only when specifically running git diff, or everywhere git diffs are displayed, such as in git log and git show?

I have only gotten it working when running explicitly git diff. Hence I was wondering did I setup it incorrectly, or is it not being used got git log -p and gitk output at all.

Exact mode, no-comparison-image mode & updated exit codes for diff-image

Would you accept a PR (or separate PRs) for diff-image that:

  1. adds an exact mode that only considers the image data the same if they are exactly the same. Is this already handled by -f 0? (i.e. does 0 fuzz require an exact match?). If not already handled by -f 0, this could be specified by -f x or -x (the latter should either be mutually exclusive with -f, or one should always override the other, or there should be a defined order precedence, like first argument is used or last argument is used)
  2. adds a "no comparison image" mode that does not generate a comparison file, but that will output a message to stdout if the image data for the files is different (and not output anything to stdout if they're the same). If this option is enabled along with "exact mode", then identify -format %# <file> could be run for each argument file & compared, which seems to be faster than the compare. If "exact mode" isn't specified, and if compare can output programmatic values other than equals/not equals (like "10% different", or "491 pixels different"), then that info could be included in the stdout message.
  3. updates the exit codes to be:
    0: both metadata & image data same
    1: metadata different, image data same
    2: metadata same, image data different
    3: both metadata & image data different
    -1: error (could have different negatives for different errors as negative exit codes count down from 255)

Kudos to the CC0 licensing

I'd really like to give a big kudos for you licensing this repo with a CC0(public domain) license. Thank you so much.

Grab diff file

I want to automate this image compare on github actions, so I want to only generate diff files, store it and don't view it.

I figured out here is the file,
exec open "$destfile"
but I want to prevent to change this file diff-image and probably there is already a command line to do this save of diff file, is there one ?

Extra diff attributes - "pixel-changes"

Context I've toolchain that regenerates images held in git (uses Selenium to capture as png from a page of a webapp on localhost. Dates change every time, which I want to forgive and revert. Pixel changes may gave happened, which I would want to not revert.

Can you add a pixel differences score to the text attributes of git diff? 0 would be no pixel differences and the number would go up from there the more changes there were. Thanks?

Sure git diff-image shows pixel changes but I'd like a scriptabilty to my goal that doesn't involve my eyeballs :)

You could implement some other way of course - like the middle of the montage pic into a file on it's own, and advice of how to query that for redness from the command line :)

Great work so far, of course.

  • Paul

Only copy diff image without showing [FOLLOW UP]

$ GIT_DIFF_IMAGE_OUTPUT_DIR=diffs git diff-image
$ ls diffs/
example-comparison.png

Originally posted by @ewanmellor in #27 (comment)

That's tricky ๐Ÿ˜€ But it works (almost) !

I run into
image
and I've to :q in my vim to continue. On a CI can't do this. Is there already an option to do it without this interaction ?
Or how to do this silent ?

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.