-
C# Image与Base64编码互转函数
- public Bitmap GetImageFromBase64(string base64string)
- {
- byte[] b = Convert.FromBase64String(base64string);
- MemoryStream ms = new MemoryStream(b);
- Bitmap bitmap = new Bitmap(ms);
- return bitmap;
- }
- public string GetBase64FromImage(string imagefile)
- {
- string strbaser64 = "";
- try
- {
- Bitmap bmp = new Bitmap(imagefile);
- MemoryStream ms = new MemoryStream();
- bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
- byte[] arr = new byte[ms.Length];
- ms.Position = 0;
- ms.Read(arr, 0, (int)ms.Length);
- ms.Close();
- strbaser64 = Convert.ToBase64String(arr);
- }
- catch (Exception)
- {
- throw new Exception("Something wrong during convert!");
- }
- return strbaser64;
- }
-
相关阅读:
cocos3 单击
cocos3 帧动画
cocos3 动作和帧动画
cocos3 场景切换特效
cocos3 场景切换
cocos3 error C2440
c++ 匿名函数
【leetcode】生成每种字符都是奇数个的字符串
【leetcode】山羊拉丁文
【leetcode】字符串的最大公因子
-
原文地址:https://www.cnblogs.com/ztf20/p/11821405.html
Copyright © 2020-2023
润新知