/// <summary> /// convert base64 string to Icon</summary> public static Bitmap StringToImage(string bitmap) { try { MemoryStream ms = new MemoryStream(); // input stream for gzip Compress.UnzipStream(bitmap, ms); return(new Bitmap(ms)); } catch (Exception e) { Program.log.Write("StringToBitmap error: " + e.Message); return(null); } }
/// <summary> /// convert Bitmap to base64 string </summary> public static string ImageToString(Bitmap image) { try { using (MemoryStream ms = new MemoryStream()) { image.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg); return(Compress.ZipStream(ms)); } } catch (Exception e) { Program.log.Write("BitmapToString error: " + e.Message); return(""); } }