David Glauser [mailto:[EMAIL PROTECTED]] wrote:

>                 public void ProcessRequest(HttpContext context)
>                 {
>                         context.Response.Clear();
>
>                         // Get the complete path and file
> name of the image file
>                         string filename =
> context.Request.PhysicalPath;
>
>                         // Convert the image file into a .png file
>                         Image newImage = new Bitmap(filename);
>
>                         MemoryStream stream = new MemoryStream();
>                         newImage.Save(stream, ImageFormat.Png);
>                         stream.Seek(0, SeekOrigin.Begin);
>
>                         // Return/Stream back the .png file
>                         context.Response.ContentType = "image/x-png";
>
> CopyStream(context.Response.OutputStream, stream);
>                 }

David,

You realize your not freeing up the memory used by the Bitmap here, right?
You should really be .Dispose()'ing newImage as soon as you're done with it.
Also, I don't know how frequently an image is being requested, but you'd be
saving tons of processing if you used some sort of caching scheme.

Later,
Drew

You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to