27 lines
458 B
C#
27 lines
458 B
C#
using System.Drawing;
|
|
using System.IO;
|
|
|
|
namespace CsharpHttpHelper.Helper
|
|
{
|
|
internal class ImageHelper
|
|
{
|
|
/// <summary>
|
|
/// 将字节数组转为图片
|
|
/// </summary>
|
|
/// <param name=" b">字节数组</param>
|
|
/// <returns>返回图片</returns>
|
|
internal static Image ByteToImage(byte[] b)
|
|
{
|
|
try
|
|
{
|
|
MemoryStream stream = new MemoryStream(b);
|
|
return Image.FromStream(stream, true);
|
|
}
|
|
catch
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|