Refactor tests

Use pregenerated image files for tests, easier than generating images in
tests. Also, fix default value for max_difference.