Skip to content

Apply fuzz before the early identical-image check - #3

Merged
hannesa2 merged 1 commit into
masterfrom
fix/fuzzy-precheck
Oct 1, 2026
Merged

hannesa2 merged 1 commit into
masterfrom
fix/fuzzy-precheck

Conversation

@hannesa2

@hannesa2 hannesa2 commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Compare's early exact pre-check ran without -fuzz, so any pixel noise (anti-aliasing, subpixel jitter) that the fuzzed compare below would treat as 'no difference' still fell through to generating a diff montage. That montage then showed nothing highlighted -- the diff was pure noise, but a diff file was still written and treated as a real difference by anything checking for its presence).

Move the fuzz/fuzz_flag computation above the pre-check and use compare -metric AE $fuzz_flag ... null: there instead of an unfuzzed compare against /dev/null.

Also drop 'File Size' from the exif fields considered meaningful: almost any byte-level difference changes the compressed size, so keeping it gated the fuzzy image pre-check behind a near-guaranteed metadata mismatch, defeating the point of the fuzz.

compare's early exact pre-check ran without -fuzz, so any pixel noise
(anti-aliasing, subpixel jitter) that the fuzzed compare below would
treat as 'no difference' still fell through to generating a diff
montage. That montage then showed nothing highlighted -- the diff was
pure noise, but a diff file was still written and treated as a real
difference by anything checking for its presence

Move the fuzz/fuzz_flag computation above the pre-check and use
'compare -metric AE $fuzz_flag ... null:' there instead of an
unfuzzed compare against /dev/null.

Also drop 'File Size' from the exif fields considered meaningful:
almost any byte-level difference changes the compressed size, so
keeping it gated the fuzzy image pre-check behind a near-guaranteed
metadata mismatch, defeating the point of the fuzz.
@hannesa2
hannesa2 force-pushed the fix/fuzzy-precheck branch from 6db1d34 to debcf6e Compare October 1, 2026 04:46
hannesa2 added a commit to gitx/gitx that referenced this pull request Oct 1, 2026
Fixes the remaining noisy-screenshot-diff problem: the early exact
pre-check in diff-image ran without -fuzz and was gated on an exif
diff that almost always fires because 'File Size' changes with any
byte difference. Together these meant a noisy (but visually identical
once fuzzed) screenshot pair still produced a diff file, even though
the rendered montage showed nothing highlighted.

refs: hannesa2/git-diff-image#3
@hannesa2
hannesa2 merged commit dd127f9 into master Oct 1, 2026
2 checks passed
@hannesa2
hannesa2 deleted the fix/fuzzy-precheck branch October 1, 2026 05:36
hannesa2 added a commit to gitx/gitx that referenced this pull request Oct 1, 2026
Fixes the remaining noisy-screenshot-diff problem: the early exact
pre-check in diff-image ran without -fuzz and was gated on an exif
diff that almost always fires because 'File Size' changes with any
byte difference. Together these meant a noisy (but visually identical
once fuzzed) screenshot pair still produced a diff file, even though
the rendered montage showed nothing highlighted.

refs: hannesa2/git-diff-image#3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant