Example #1
0
 private static long CalculateActualHash(string fileName)
 {
     using var fileStream = new FileStream(fileName, FileMode.Open, FileAccess.Read);
     using var image      = PpmReader.ImageFromPpm(fileStream);
     ImagePipeline.FromImage(image).Webp(new WebpOptions(100, 100, true)).ToBuffer(out var actual);
     return(DifferenceHash.HashLong(actual));
 }
            public void reads_frame()
            {
                using var fileStream = new FileStream(Common.GetInputFilePath("pattern.ppm"), FileMode.Open, FileAccess.Read);
                var frame = PpmReader.Read(fileStream);

                frame.ShouldNotBeNull();
                frame.Width.ShouldBe(3);
                frame.Height.ShouldBe(2);
                frame.Colors.Count.ShouldBeGreaterThan(0);

                frame.Colors[0].ShouldBe(NamedColors.Red);
                frame.Colors[1].ShouldBe(NamedColors.Green);
                frame.Colors[2].ShouldBe(NamedColors.Blue);

                frame.Colors[3].ShouldBe(NamedColors.Yellow);
                frame.Colors[4].ShouldBe(NamedColors.White);
                frame.Colors[5].ShouldBe(NamedColors.Black);
            }