You can also use ImageMagick to generate a "diff" image:
magick compare img1.jpg img2.jpg diff.jpg
If you want a numeric result, you can use "-metric AE" (and a null output file) to count the number of pixels that differ.
There is also a "fuzz" option: -fuzz 2%