locked
Runtime generation of image looses picture quality RRS feed

  • Question

  • User230766423 posted

    Hi, 

     

     Following code looses image picture quality.

    how this can be resolved?

    Image
    img = new Bitmap(context.Server.MapPath(context.Session["ImagePath"].ToString()));

     

    //using (Graphics g = Graphics.FromImage(img))

    //{

    // g.DrawString("ProfessorX", new Font("tahoma", 12f), new SolidBrush(Color.Black), new Point(50, 50));

    //}

    context.Response.Clear();

    context.Response.ContentType =
    "image/bmp";using (MemoryStream stream = new MemoryStream())

    {

    img.Save(stream, System.Drawing.Imaging.
    ImageFormat.Bmp);

    stream.WriteTo( context.Response.OutputStream);

     

     

    //byte[] b = GetImageBytes(img);

    //context.Response.OutputStream.Write(b, 0, b.Length);

    }

    Tuesday, May 26, 2009 2:46 AM

Answers