来自于:Rex_IT
#region 图片的Base64/// <summary>/// 图片的Base64转换/// </summary>public class ImageBase64{/// <summary>/// 将图片数据转换为Base64字符串/// </summary>/// <param name="imagefilepath">文件路径</param>public static String ImageToBase64(String imagefilepath){byte[] bytes = FileUtil.getBytes(imagefilepath);string base64 = Convert.ToBase64String(bytes);return base64;}/// <summary>/// 将Base64字符串转换为图片/// </summary>/// <param name="Strbase64">图片的Base64值</param>public static Image Base64ToImage(string Strbase64){byte[] bytes = Convert.FromBase64String(Strbase64);System.IO.MemoryStream ms = new System.IO.MemoryStream(bytes);System.Drawing.Image img = System.Drawing.Image.FromStream(ms);return img;}}#endregion
