Martin's corner on the web

Image diff tool

I occasionally need to compare two versions of a diagram or a screenshot to see what actually changed. There are free websites for this, but they all want the images uploaded to their server, and the diffs they produce are usually either too noisy or too quiet for what I’m comparing.

So I agent-coded my own. It runs locally, the images stay on the machine, and the defaults are tuned around the kinds of comparisons I do. Live demo at imgdiff.harizanov.com.

Here’s the workflow. Imagine I have a new revision of an architectural diagram (completely made-up example) and want to see what changed since the previous version:

Original architecture

Updated architecture

I drag both images into the tool. It auto-aligns them and offers a handful of comparison modes – slider, split, fade with blink, highlight, and subtract. The pair almost always needs a small alignment fix (someone re-exported at a slightly different zoom, the canvas grew by a few pixels), so the tool tries four candidate transforms in parallel and keeps whichever one improves SSIM the most. If none of them help, it leaves the images alone rather than warping them into something that only looks aligned.

For larger images, the Boxes feature draws numbered regions around the candidate differences so I can walk through them and mark each as accepted, rejected, or pending. Once a few are marked, Auto-tune uses them as ground truth and searches for detection settings that fit the current pair better than the defaults did. There’s also an optional Analyze step that sends the cropped contents of accepted boxes to an OpenAI-compatible endpoint for a short written description; the rest of the tool works without it.

None of the underlying pieces are new – SSIM, ECC, and contour detection have been around forever, and I’m sure someone will tell me there’s a one-liner that does most of this. The point was to wire them into something I’d actually reach for, running on my own machine. If it’s useful to you too, it’s at imgdiff.harizanov.com.

Tagged on:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.