public static ImageSource ResourceImageSource(string imageName, double scale) { using (Bitmap img = IconSets.ResourceBitmap(imageName)) { if (img == null) { return(null); } Size smallSize = ImageConverters.ScaleImage(img.Width, img.Height, scale); using (Bitmap resized = new Bitmap(img, smallSize)) { return(ImageConverters.ConvertToImageSource(resized)); } } }
public static ImageSource LoadFromFile(string path) { Bitmap bmp = new Bitmap(path); return(ImageConverters.ConvertToImageSource(bmp)); }