fn compare_to_truth_image_with_tolerance<P>(actual: &Image<P>, truth_file_name: &str, tol: u8)
where
    P: Pixel<Subpixel = u8> + PixelWithColorType,
    Image<P>: FromDynamic,
{
    if should_regenerate() {
        actual
            .save(Path::new(TRUTH_DIR).join(truth_file_name))
            .unwrap();
    } else {
        let truth = Image::<P>::from_dynamic(&load_image_or_panic(
            Path::new(TRUTH_DIR).join(truth_file_name),
        ));
        assert_pixels_eq_within!(*actual, truth, tol);
    }
}
Checks that an image matches a 'truth' image to within a given per-pixel tolerance.
tests/regression.rs