C# Image.Clone to byte[] causes EDIT.COM to open on Windows XP
- by JayDial
It appears that cloning a Image and converting it to a byte array is causing EDIT.COM to open up on Windows XP machines. This does not happen on a Windows 7 machine. The application is a C# .NET 2.0 application. Does anyone have any idea why this may be happening?
Here is my Image conversion code:
public static byte[] CovertImageToByteArray(Image imageToConvert)
{
imageToConvert.Clone() as Image;
if(clone == null)
return null;
imageToConvert.Dispose();
byte[] imageByteArray;
using (MemoryStream ms = new MemoryStream())
{
clone.Save(ms, clone.RawFormat);
imageByteArray = ms.ToArray();
}
return imageByteArray;
}
public static Image ConvertByteArrayToImage(byte[] imageByteArray,
ImageFormat formatOfImage)
{
Image image;
using (
MemoryStream ms = new MemoryStream(imageByteArray, 0,
imageByteArray.Length))
{
ms.Write(imageByteArray, 0, imageByteArray.Length);
image = Image.FromStream(ms, true);
}
return image;
}
Thanks
Justin