Can you try this function to convert to byte array
// C# to convert a string to a byte array.
public static byte[] StrToByteArray(string str)
{
System.Text.UTF8Encoding encoding=new System.Text.UTF8Encoding();
return encoding.GetBytes(str);
}
and pass the byte array for generating the image
public static Image CreateImage(byte[] imageData)
{
Image image;
using (MemoryStream inStream = new MemoryStream())
{
inStream.Write(imageData, 0, imageData.Length);
cninjas
Contributor
4868 Points
851 Posts
Re: binary string to image?
May 07, 2012 12:26 PM|LINK
hi
Can you try this function to convert to byte array
// C# to convert a string to a byte array.
public static byte[] StrToByteArray(string str)
{
System.Text.UTF8Encoding encoding=new System.Text.UTF8Encoding();
return encoding.GetBytes(str);
}
and pass the byte array for generating the image
public static Image CreateImage(byte[] imageData)
{
Image image;
using (MemoryStream inStream = new MemoryStream())
{
inStream.Write(imageData, 0, imageData.Length);
image = Bitmap.FromStream(inStream);
}
return image;
}
Hope it helps,thanks.
Niranjan