#!/bin/sh

set -e

# https://www.imagemagick.org/Usage/canvas/#random_noise
convert -size 1920x1200 xc: +noise random reference.png

png2ff < reference.png | ff2png > test.png

# When no fuzz value is specified, compare(1) returns 0 when two images are
# identical, and 1 when they differ. This is true with any metric (even with
# the default metric: the normalized cross correlation), but let's use the
# simplest one, Absolute Error, which counts the number of different pixels.
#
# https://www.imagemagick.org/Usage/compare/#compare

compare -metric AE reference.png test.png null: 2>&1
