Пример #1
0
 public void SharpSharpFileFile()
 {
     using var output = TestFiles.OutputJpg();
     ImagePipeline
     .FromFile(TestFiles.InputJpg)
     .Resize(Width, Height)
     .ToFile(output.Path);
 }
 public DifferenceHashBenchmark()
 {
     ImagePipeline
     .FromFile(TestFiles.InputJpg)
     .Png()
     .ToBuffer(out var b);
     buffer = b;
 }
Пример #3
0
 public static void read_file_write_stream()
 {
     using var outputFile   = TestFiles.OutputJpg();
     using var outputStream = new FileStream(outputFile.Path, FileMode.Open, FileAccess.Write);
     ImagePipeline
     .FromFile(TestFiles.InputJpg)
     .TestActions()
     .ToStream(outputStream, VerifyImageInfo);
 }
Пример #4
0
        private static void Main()
        {
            ImagePipeline
            .FromFile(TestFiles.InputJpg)
            .Png()
            .ToBuffer(out var b);
            var hashLong  = DifferenceHash.HashLong(b);
            var hashShort = DifferenceHash.HashShort(b);

            Console.WriteLine(Reverse(Convert.ToString(hashLong, 2)));
            Console.WriteLine(Reverse(Convert.ToString(hashShort, 2)));
        }
Пример #5
0
 private static ImagePipeline TestPipeline() =>
 ImagePipeline
 .FromFile(TestFiles.InputJpg)
 .Resize(320, 240);
Пример #6
0
 private static long CalculateExpectedHash(string fileName)
 {
     ImagePipeline.FromFile(fileName).Webp(new WebpOptions(100, 100, true)).ToBuffer(out var expected);
     return(DifferenceHash.HashLong(expected));
 }