Gif image : Mime type « Page Lifecycle « ASP.NET Tutorial






<%@ Page language="c#" %>
<%@ Import Namespace="System.Drawing" %>
<%@ Import Namespace="System.Drawing.Imaging" %>
<%@ Import Namespace="System.Drawing.Drawing2D" %>
<%@ Import Namespace="System.Drawing.Text" %>
<script runat="server">

    private void Page_Load(object sender, System.EventArgs e)
    {
      Bitmap InputBitmap = new Bitmap(Server.MapPath("logo.gif"));
      
      int newWidth = 100;
      int newHeight = 100;
      Bitmap OutputBitmap = new Bitmap(InputBitmap, newWidth, newHeight);

      Response.Clear();
      Response.ContentType="image/Gif";

      OutputBitmap.Save(Response.OutputStream, ImageFormat.Gif);

      OutputBitmap.Dispose();
      InputBitmap.Dispose();
    }

</script>








5.15.Mime type
5.15.1.set the mime type
5.15.2.JPeg image
5.15.3.Gif image