-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathUtils.cs
30 lines (27 loc) · 917 Bytes
/
Utils.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.Drawing;
using System.IO;
namespace Sekte
{
public static class Utils
{
public static Image Base64ToImage(string base64String)
{
base64String = base64String.Replace(@"\n", "").Replace(@"'", "").Substring(1);
// Convert base 64 string to byte[]
byte[] imageBytes = Convert.FromBase64String(base64String);
// Convert byte[] to Image
using (var ms = new MemoryStream(imageBytes, 0, imageBytes.Length))
{
Image image = Image.FromStream(ms, true);
return image;
}
}
public static void ResmiAc(string dosyaAdi, Image resim)
{
string path = Path.Combine(Path.GetTempPath(), dosyaAdi);
resim.Save(path);
System.Diagnostics.Process.Start(path);
}
}
}