Show Image using byte array in WPF

Convert your image in to byte array
private byte[] GetImageAsByteArray(string imageName)
var streamResourceInfo =
Application.GetResourceStream(new Uri("YourProjectNameSpace;component/ImageFolderName/"+imageName)",
byte[] image = {};
if (streamResourceInfo != null)
var length = streamResourceInfo.Stream.Length;
image = new byte[length];
streamResourceInfo.Stream.Read(image, 0, (int)length);
return image;

Sample Usage
var yourViewModel = new ViewModel();

Bind the property to the image control

<Image Source=”{Binding Image}”></Image>

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s