public void LoadOptions(string path) { Options options; IFormatter formatter = new BinaryFormatter(); try { Stream serializationStream = File.Open(path, FileMode.Open); options = (Options)formatter.Deserialize(serializationStream); serializationStream.Close(); } catch { options = new Options(); } CopyFrom(options); }
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); } }
public void CopyFrom(Options mOptions) { mColumnCount = mOptions.ColumnCount; mTileWidth = mOptions.TileWidth; mTileHeight = mOptions.TileHeight; mGapWidth = mOptions.GapWidth; mGapHeight = mOptions.GapHeight; mOffsetX = mOptions.OffsetX; mOffsetY = mOptions.OffsetY; mShadowIntensity = mOptions.ShadowIntensity; mInfoPosition = mOptions.InfoPositions; mDetailPosition = mOptions.DetailPosition; mJpegQuality = mOptions.JpegQuality; mAutoFitTiles = mOptions.AutoFitTiles; mDropShadow = mOptions.DropShadow; mLabels = mOptions.Labels; mDetails = mOptions.Details; mBackColor = mOptions.BackColor; mInfoFontColor = mOptions.InfoFontColor; mDetailFontColor = mOptions.DetailFontColor; mBackgroundImage = mOptions.BackgroundImage; mDetailText = mOptions.DetailText; mDetailFont = mOptions.DetailFont; mInfoFont = mOptions.InfoFont; OnOptionsChanged(); }
//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(); }