I
iyuen
I'm trying to convert byte array (valid bitmap format) into some bitmaps and
back to byte array again. But when I inspect the content of the array
before and after the conversion they are different. I'm used the following
code to do the conversion. May any of you tell me what's happening?
Thanks,
Here are my code....
internal static Bitmap convertImage(string imageText)
{ imageText = imageText.Replace("\r\n", String.Empty);
Byte[] bitmapData;
bitmapData = Convert.FromBase64String(imageText);
MemoryStream streamBitmap = new MemoryStream(bitmapData);
return new Bitmap(streamBitmap);}
}
internal static string convertBase64Array(Bitmap bmp)
{ MemoryStream bmpStream = new MemoryStream();
bmp.Save(bmpStream, System.Drawing.Imaging.ImageFormat.Bmp);
byte[] bmpArray = new byte[bmpStream.Length];
bmpStream.Read(bmpArray, 0, Convert.ToInt32(bmpStream.Length));
return Convert.ToBase64String(bmpArray);}
--
back to byte array again. But when I inspect the content of the array
before and after the conversion they are different. I'm used the following
code to do the conversion. May any of you tell me what's happening?
Thanks,
Here are my code....
internal static Bitmap convertImage(string imageText)
{ imageText = imageText.Replace("\r\n", String.Empty);
Byte[] bitmapData;
bitmapData = Convert.FromBase64String(imageText);
MemoryStream streamBitmap = new MemoryStream(bitmapData);
return new Bitmap(streamBitmap);}
}
internal static string convertBase64Array(Bitmap bmp)
{ MemoryStream bmpStream = new MemoryStream();
bmp.Save(bmpStream, System.Drawing.Imaging.ImageFormat.Bmp);
byte[] bmpArray = new byte[bmpStream.Length];
bmpStream.Read(bmpArray, 0, Convert.ToInt32(bmpStream.Length));
return Convert.ToBase64String(bmpArray);}
--