Package cmpimg compares the raw representation of images taking into account idiosyncracies related to their underlying format (SVG, PDF, PNG, ...).



    This section is empty.


    View Source
    var GenerateTestData = flag.Bool("regen", false, "Uses the current state to regenerate the test data.")


    func CheckPlot

    func CheckPlot(ExampleFunc func(), t *testing.T, filenames ...string)

      CheckPlot checks a generated plot against a previously created reference. If generateTestData = true, it regenerates the reference. For image.Image formats, a base64 encoded png representation is output to the testing log when a difference is identified.

      func Diff

      func Diff(dst draw.Image, a, b image.Image) image.Rectangle

        Diff calculates an intensity-scaled difference between images a and b and places the result in dst, returning the intersection of a, b and dst. It is the responsibility of the caller to construct dst so that it will overlap with a and b. For the purposes of Diff, alpha is not considered.

        Diff is not intended to be used for quantitative analysis of the difference between the input images, but rather to highlight differences between them for testing purposes, so the calculation is rather naive.

        func Equal

        func Equal(typ string, raw1, raw2 []byte) (bool, error)

          Equal takes the raw representation of two images, raw1 and raw2, together with the underlying image type ("eps", "jpeg", "jpg", "pdf", "png", "svg", "tiff"), and returns whether the two images are equal or not.

          Equal may return an error if the decoding of the raw image somehow failed.


          This section is empty.