ProjetThe/ProjetTheAlone/Outil/picToByteArray.cs

24 lines
571 B
C#
Raw Normal View History

2019-01-24 22:24:05 +01:00
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ProjetTheAlone.Outil
{
class picToByteArray
{
public static byte[] Convert(string imgPath)
{
FileStream fs = new System.IO.FileStream(@".\desert.jpg", FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
byte[] result = br.ReadBytes((int)fs.Length);
br.Close();
fs.Close();
return result;
}
}
}