|
沙发
楼主 |
发表于 2017-11-9 11:21:24
|
只看该作者
自己抄袭网上修改搞定了。
public static void Execute(Dictionary<string, string> stringDic,Dictionary<string, List<string>> listDic, Dictionary<string, int> intDic)
{
System.Drawing.Bitmap bmp1 = new System.Drawing.Bitmap(stringDic["本地图片地址"]);
using (MemoryStream ms1 = new MemoryStream())
{
bmp1.Save(ms1, System.Drawing.Imaging.ImageFormat.Jpeg);
byte[] arr1 = new byte[ms1.Length];
ms1.Position = 0;
ms1.Read(arr1, 0, (int)ms1.Length);
ms1.Close();
stringDic["img_base64"] = Convert.ToBase64String(arr1);
}
} |
|