ASP.NET中二进制流生成图片

public partial class SystemManage_ModulePicture : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
         if (!IsPostBack)
        {
           string strModuleID=Request.QueryString["ModuleID"].ToString();
            Module instance = new Module();
            byte[] imgData = instance.GetOneModule(strModuleID).IconFile;           //得到二进制图片数据

            if (imgData != null && imgData.Length != 0)
            {
                try
                {
                    System.IO.MemoryStream ms = new System.IO.MemoryStream(imgData);
                    System.Drawing.Image img = System.Drawing.Image.FromStream(ms);
                    img.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif);        //展现图片
                }
                catch
                {
 
                }
            }
        }
    }
}
原文地址:https://www.cnblogs.com/ToFlying/p/3141605.html