yahoo / blink-diff

A lightweight image comparison tool.
http://yahoo.github.io/blink-diff/
MIT License
1.21k stars 90 forks source link

showing "real" diffs? #57

Open Pomax opened 5 years ago

Pomax commented 5 years ago

Pixel diffing is nice, but is there a way to tell this library that I care about "what is different" and not "highlighting the entire document just because there's extra vertical whitespace relatively high up in the image"?

For example, if I have two screenshots of a webpage, one with body { padding-top: 20px; } and one with body { padding-top: 20em; } then the only difference is going to be the extra whitespace. Everything else is identical, so having the entire image flagged as "diff" would be wrong (think of it as a github diff: a change that adds the letter a to the start of a README.md does not change the entire document. All it does is add an a, the rest of the document is still the same as before).

Is there a way to tell blink-diff to find diffs but with maximum shift detection?

josieoharrow commented 5 years ago

Hello, I am not sure if this would work for what you're trying to do, but have you looked at the h-shift capacity? For a simple ignore horizontal diffs (over your entire image, I believe) it works pretty well.

Pomax commented 5 years ago

I looked at more permissible h-shift and v-shift values, but that didn't really work. I'm trying to find libraries that do visual diffing in the same way we all understand text diffing should work (e.g. if you move something around, or add some text at the start, that move or add is the diff, not "almost the entire document has changed" =) so I was hoping blink-diff could do that. If it can't, no worries, it just means the search goes on.