static void Main(string[] args)
        {
            Console.WriteLine("Starting...\n");

            Task.Run(async() =>
            {
                JPEGLibrary.Encoder encodedImage = new JPEGLibrary.Encoder(
                    image: Resources.lena,
                    imageName: "Dino",
                    quality: 50,
                    saveTextfiles: false);

                await encodedImage.Encode();

                #region Print
                Console.WriteLine($"Quality: \n{encodedImage.Quality}\n");
                Console.WriteLine("Entropy: ");
                foreach (var value in encodedImage.Entropy.GetPropertyValues())
                {
                    Console.WriteLine(value);
                }
                ;
                #endregion

                Decoder decoder = new Decoder(encodedImage);
                await decoder.Decode();

                #region Print/Save
                Console.WriteLine("\nPSNR: ");
                Console.WriteLine(decoder.PSNR_R + " db");
                Console.WriteLine(decoder.PSNR_G + " db");
                Console.WriteLine(decoder.PSNR_B + " db");

                string output = $"{ encodedImage.ImageName }_quality={ encodedImage.Quality}.png";
                decoder.DecodedImage.Save(output, ImageFormat.Png);

                //ELA


                #endregion

                Environment.Exit(0);
            });

            Ela();

            Console.WriteLine("Done");
            Console.ReadLine();
        }
Exemple #2
0
 public Decoder(Encoder encodedImage)
 {
     enc = encodedImage;
 }