Example #1
0
        public static AsScanned CheckImage(string imagePath)
        {
            AsScanned scan = new AsScanned();

            scan.Image = imagePath;

            double  filelen = new FileInfo(imagePath).Length;
            string  f_size  = " (" + AppCore.GetFileSize(filelen) + ")";
            Process process = CreateProcess("/C \"arcoreimg.exe eval-img --input_image_path=" + imagePath);

            process.Start();

            try
            {
                string result = process.StandardOutput.ReadToEnd();
                process.WaitForExit();
                int score = int.Parse(result);
                scan.Score = score;


                if (score < 49)
                {
                    scan.Title = Path.GetFileName(imagePath) + f_size + " | Poor Quality Image";
                }

                else if (score > 50 && score < 89)
                {
                    scan.Title = Path.GetFileName(imagePath) + f_size + " | Good Quality Image";
                }

                else if (score > 90)
                {
                    scan.Title = Path.GetFileName(imagePath) + f_size + " | Best Quality Image";
                }
            }
            catch (Exception)
            {
                //arcoreimg.WriteLogs("App Errors", @" " + ex.Message, @"" + ex.InnerException, @"" + ex.StackTrace);
            }
            return(scan);
        }