Beispiel #1
0
        void Run()
        {
            MagickWandEnvironment.Genesis();

            var qr = (double)MagickWandEnvironment.QuantumRange;

            WriteLine(new string[] { "Quantum Range", $"{qr}" });
            Console.WriteLine();
            WriteLine(new string[] { "Image Name", "Mean", "StdDev", "Mean (pct)", "StdDev (pct)", "Kurtosis", "Skew" });

            foreach (var file in Directory.GetFiles(_opts.PhotoRoot))
            {
                double mean, stddev, kurtosis, skewness;

                using (var wand = new MagickWand(file))
                {
                    wand.AutoLevelImage();
                    wand.GetImageChannelMean(ChannelType.AllChannels, out mean, out stddev);
                    wand.GetImageChannelKurtosis(ChannelType.AllChannels, out kurtosis, out skewness);

                    WriteLine(new string[] { $"{Path.GetFileName(file)}", $"{mean}", $"{stddev}", $"{mean / qr}", $"{stddev / qr}", $"{kurtosis}", $"{skewness}" });
                }
            }

            MagickWandEnvironment.Terminus();
        }
Beispiel #2
0
        Task ExecuteAsync()
        {
            MagickWandEnvironment.Genesis();

            Console.WriteLine("Generating new thumbnails for photos...");
            _thumbnailProcess.CreateNewPhotoThumbnails();

            Console.WriteLine("Generating new thumbnails (and replacing old pngs with jpgs) for videos...");
            _thumbnailProcess.CreateNewVideoThumbnails();

            // var photos = await _repo.GetPhotosAsync();
            // var videos = await _repo.GetVideosAsync();

            // Console.WriteLine($"Found {photos.Count()} photos in db");
            // Console.WriteLine($"Found {videos.Count()} videos in db");

            var photoFiles = _storage.GetPhotos();
            var videoFiles = _storage.GetVideos();

            Console.WriteLine($"Found {photoFiles.Count()} photos on filesystem");
            Console.WriteLine($"Found {videoFiles.Count()} videos on filesystem");

            Console.WriteLine("Trying to gather additional metadata for video files...");
            _videoMetadataGatherer.Gather(videoFiles);
            Console.WriteLine("Finished gathering additional metadata for video files.");

            WriteSqlScript(photoFiles, videoFiles);

            MagickWandEnvironment.Terminus();

            return(Task.CompletedTask);
        }