internal static BinaryImage ToBinaryImage(this ImageSource image) { var bitmapImage = image as BitmapImage; var bmp = bitmapImage !.ToBitmap(); return(BinaryImage.FromImage(bmp)); }