In a recent development, when you edit an image, crop, retouch, remove an object, it is useful to see exactly which pixels changed. Desktop tools can do this, but a tiny in-browser diff viewer is handy for reviews, documentation and QA of image pipelines. Here is one in plain JavaScript with the Canvas API: no libraries, no uploads, everything stays on the user's machine.
Recent findings suggest that both images must have the same dimensions. Load the first one at its natural size and force the second to match, otherwise every pixel will look different.
The threshold matters. JPEG re-compression changes almost every pixel by a few levels, so a threshold around 10-15 ignores compression noise and highlights real edits.
Industry observers note that red areas changed, blue areas did not. A small, compact red patch means a local edit; red speckle everywhere means the whole image was re-encoded or resized.
According to recent reports, heatmaps are precise, but people understand a before/after slider faster. Stack the two images, clip the top one with clip-path: inset(0 calc(100% - var(--pos)) 0 0) and drive --pos from a range input. Offer both views: the slider to show what changed, the heatmap to prove nothing else did.
For a real-world reference of that presentation, GGemini's before-and-after gallery uses comparison sliders to show local edits on AI-generated images, which is exactly the case where a diff heatmap should come back mostly blue with one small red region.
Forty lines of code, zero dependencies, and you have an honest answer to the question every image reviewer asks: what exactly did this edit change?
