//public Thumbnailer(MediaInfo Info, MagickImage Screenshot, string Label) //{ // mInfo = Info; // mOptions = new Options(); // mOptions.LoadOptions(); // mOptions.ColumnCount = 1; // mOptions.Details = false; // mOptions.DropShadow = false; // mOptions.GapHeight = 0; // mOptions.GapWidth = 0; // mOptions.Labels = false; // mOptions.TileWidth = mInfo.Width; // mOptions.TileHeight = Info.Height; // mScreenshots = new MagickImageCollection(); // //mScreenshots = new List<Bitmap>(); // mLabels = new List<string>(); // mScreenshots.Add(Screenshot); // mLabels.Add(Label); // mThumbCount = 1; // mInterpolation = InterpolationMode.HighQualityBicubic; // UpdateTileSize(); // UpdateImageSize(); // UpdateShadowTemplate(); // ResizeScreenshots(); // UpdateDetails(); // UpdateResult(); // SetOptionEvents(); //} //public Thumbnailer(MediaInfo Info, Options pOptions, MagickImageCollection Screenshots, IList<string> Labels, InterpolationMode Mode) //{ // mInfo = Info; // mOptions = pOptions; // mScreenshots = Screenshots; // mLabels = Labels; // mThumbCount = Screenshots.Count; // mInterpolation = Mode; // UpdateTileSize(); // UpdateImageSize(); // UpdateShadowTemplate(); // ResizeScreenshots(); // UpdateDetails(); // UpdateResult(); // SetOptionEvents(); //} public Thumbnailer(MediaInfo Info, Options pOptions, MagickImageCollection Screenshots) { mInfo = Info; mOptions = pOptions; mScreenshots = Screenshots; mLabels = GetLabels(Screenshots); CalculateLabelHeight(); mThumbCount = Screenshots.Count; UpdateTileSize(); UpdateImageSize(); UpdateShadowTemplate(); ResizeScreenshots(); UpdateDetails(); UpdateResult(); SetOptionEvents(); }
private void MakeMosaic(List<string> list) { using (MagickImageCollection images = new MagickImageCollection()) { foreach (string imagePath in lstFilesFound) { try { MagickImage first = new MagickImage(imagePath); images.Add(first); } catch (Exception ex) { if (ex is MagickCorruptImageErrorException || ex is MagickImageErrorException || ex is MagickDelegateErrorException || ex is MagickMissingDelegateErrorException || ex is MagickFileOpenErrorException) { //Not an image, or improper image Console.WriteLine(ex.Message); } } } MediaInfo info = new MediaInfo(lstFilesFound); Options options = new Options(); options.DropShadow = false; options.AutoFitTiles = true; options.Details = true; options.TileHeight = 180; options.TileWidth = 240; //options.DetailText = Path.GetDirectoryName(lstFilesFound[0]); //MagickImageCollection imagesbmp = new MagickImageCollection(); //foreach (MagickImage magickImage in images) //{ // imagesbmp.Add(magickImage.ToBitmap()); //} Thumbnailer thumbnailer = new Thumbnailer(info, options, images); // path is your file path //string directory = Path.GetDirectoryName(info.DirectoryPath); string directoryString = CreateDirectoryString(new DirectoryInfo(info.DirectoryPath)); string path = Path.Combine(info.DirectoryPath, "contact-sheet"); thumbnailer.Result.Save(path, ImageFormat.Jpeg); } }
private IList<string> GetLabels(MagickImageCollection screenshots) { List<string> labelInfo = new List<string>(); foreach (MagickImage magickImage in screenshots) { MediaInfo mediaInfo = new MediaInfo(magickImage); labelInfo.Add(mediaInfo.FileName + "\r\n" + mediaInfo.ImageDate); } return labelInfo; }