Getting a JPEG image from a hex string in XML.
Posted
by Jesse Knott
on Stack Overflow
See other posts from Stack Overflow
or by Jesse Knott
Published on 2010-04-04T13:34:11Z
Indexed on
2010/04/04
13:43 UTC
Read the original article
Hit count: 473
Well here goes, I am trying to collect a picture that is encoded as a hex string in an xml file. I have been looking all over for the answer to this and have not been able to find it any where. Here is what I have now.
byte[] bytes = Convert.FromBase64String(FilterResults("PHOTOGRAPH"));
MemoryStream mem = new MemoryStream(bytes);
Image bmp2 = Image.FromStream(mem);
return bmp2;
The FilterResults function just returns the string from the XML. I am able to get the string of characters and convert it into a byte[] but as soon as I execute the Image.FromStream(mem) I get an "Parameter Incorrect" error.
Any ideas?
© Stack Overflow or respective owner