Reputation: 1371
I have an array of string from which I need to Draw an image in Windows forms.
I've done the following two steps:
and used the following code:
Image image = Image.FromStream(memory stream);
But it always returns null.
Upvotes: 0
Views: 120
Reputation: 1097
You can get image from byte array:
public Image byteArrayToImage(byte[] byteArrayIn)
{
MemoryStream ms = new MemoryStream(byteArrayIn);
Image returnImage = Image.FromStream(ms);
return returnImage;
}
Be aware with formats. For example, Silverlight and WPF support only JPEG or PNG. Otherwise will get an exception.
Upvotes: 1