2019-04-20 15:51:50 +02:00
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.IO;
|
2019-04-14 10:00:38 +02:00
|
|
|
|
|
|
|
|
|
namespace Mk0.Tools.Convert
|
|
|
|
|
{
|
2019-04-14 11:00:17 +02:00
|
|
|
|
public static class ByteConvert
|
2019-04-14 10:00:38 +02:00
|
|
|
|
{
|
2019-04-20 15:51:50 +02:00
|
|
|
|
public static Image ToImage(this byte[] byteArray)
|
2019-04-14 10:00:38 +02:00
|
|
|
|
{
|
2019-04-20 15:51:50 +02:00
|
|
|
|
using (MemoryStream ms = new MemoryStream(byteArray))
|
|
|
|
|
{
|
2019-05-04 14:45:28 +02:00
|
|
|
|
using (var bitmap = new Bitmap(ms))
|
|
|
|
|
{
|
|
|
|
|
var bitmapCopy = new Bitmap(bitmap, bitmap.Width, bitmap.Height);
|
|
|
|
|
return bitmapCopy;
|
|
|
|
|
}
|
2019-04-20 15:51:50 +02:00
|
|
|
|
}
|
2019-04-14 10:00:38 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|