nature_net.configurations.GetThumbnailFromImage C# (CSharp) Method

GetThumbnailFromImage() public static method

public static GetThumbnailFromImage ( string filename, int height ) : ImageSource
filename string
height int
return ImageSource
        public static ImageSource GetThumbnailFromImage(string filename, int height)
        {
            BitmapImage bi = new BitmapImage();
            try
            {
                // create the thumbnail
                bi.BeginInit();
                bi.DecodePixelHeight = height;
                //bi.DecodePixelWidth = width;
                bi.CacheOption = BitmapCacheOption.OnLoad;
                bi.UriSource = new Uri(configurations.GetAbsoluteContributionPath() + filename);
                bi.EndInit();
                bi.Freeze();
            }
            catch (Exception)
            {
                // could not create thumbnail -- reason: filenotfound or currupt download or ...
                // write log
                return null;
            }
            return bi;
        }