lundi 5 octobre 2015

image checksums for asserting unchanged visual output

I have a library that produces images from code, and I would like to write a capability test suite that loops over a number of test cases and does the following:

  1. Create a PNG image from the test case,
  2. create a checksum of the image, and
  3. assert that the checksum is the same as the reference checksum.

By comparing with precomputed reference checksums, I can be sure that the behavior or the library doesn't change without checking the images pixel by pixel.

I noticed that when creating PNGs, no two files are exactly alike although they look alike. I suppose a time stamp of sorts is always stored in the file. This rules (plain) PNG files out for this purpose.

What is an appropriate file format/hash algorithm for asserting that the visual output doesn't change?

Aucun commentaire:

Enregistrer un commentaire