What's in the array of bytes - is it a valid bitmap or jpeg image? If it's raw pixel data, you need to use the Bitmap constructor that takes raw image data Andrew
-----Original Message----- From: Discussion of advanced .NET topics. [mailto:[EMAIL PROTECTED] On Behalf Of Hevel, Shawn Sent: Friday, January 05, 2007 9:23 AM To: ADVANCED-DOTNET@DISCUSS.DEVELOP.COM Subject: [Spam:***** SpamScore] [ADVANCED-DOTNET] Conversion Error I'm trying to convert a System.Byte[] into System.Drawing.Image. I've included my code below. When I execute System.Drawing.Image.FromStream(ms) I get the following error: System.ArgumentException: Parameter is not valid. Does anyone have an idea as to why this is throwing an error? public System.Drawing.Image ByteArrayToImage(Byte[] byteArrayIn) { MemoryStream ms = new MemoryStream(byteArrayIn); System.Drawing.Image returnImage = System.Drawing.Image.FromStream(ms); return returnImage; } Thanks, Shawn Hevel, API, AIT Lead Programmer Analyst Information Technology Department South Carolina Farm Bureau Insurance Companies Phone: (803) 936-4331 Fax: (803) 936-4629 Work Email: [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> Home Email: [EMAIL PROTECTED] =================================== This list is hosted by DevelopMentor(r) http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com -- BEGIN-ANTISPAM-VOTING-LINKS ------------------------------------------------------ Teach CanIt if this mail (ID 7078962) is spam: Spam: http://mail-gw.cognex.com/canit/b.php?c=s&i=7078962&m=4a8153b89339 Not spam: http://mail-gw.cognex.com/canit/b.php?c=n&i=7078962&m=4a8153b89339 Forget vote: http://mail-gw.cognex.com/canit/b.php?c=f&i=7078962&m=4a8153b89339 ------------------------------------------------------ END-ANTISPAM-VOTING-LINKS =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com