A generic error occurred in GDI+ at System.Drawing.Image.Save
When you are loading an imagefrom a Stream, You have to keep the stream open for the lifetime of the image, see this MSDN Image.FromStream. I think the exception is caused because the memory stream gets closed even before the image gets disposed. You can change your code like this: byte[] bitmapData = new byte[imageText.Length]; … Read more