private async Task getImg() { try { if (string.IsNullOrEmpty(setVLogo.value)) { HelpClass.clearImg(img_customer); } else { byte[] imageBuffer = await setVLogo.downloadImage(setVLogo.value); // read this as BLOB from your DB var bitmapImage = new BitmapImage(); if (imageBuffer != null) { using (var memoryStream = new MemoryStream(imageBuffer)) { bitmapImage.BeginInit(); bitmapImage.CacheOption = BitmapCacheOption.OnLoad; bitmapImage.StreamSource = memoryStream; bitmapImage.EndInit(); } img_customer.Background = new ImageBrush(bitmapImage); // configure trmporary path // string dir = Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName; string dir = Directory.GetCurrentDirectory(); string tmpPath = System.IO.Path.Combine(dir, Global.TMPSettingFolder); tmpPath = System.IO.Path.Combine(tmpPath, setVLogo.value); openFileDialog.FileName = tmpPath; } else { HelpClass.clearImg(img_customer); } } } catch { } }