Rewrite tests to use an image comparison binary instead of md5sum.

This allows to check for at most 1% image change with no metadata change
instead of a perfect match, that fails when using fused-multiply-add
instructions.

See, for context on why this is needed:
https://blog.flameeyes.eu/2014/10/the-subtlety-of-modern-cpus-or-the-search-for-the-phantom-bug