System.Drawing.Image _gifImage;
_gifImage = System.Drawing.Image.FromFile(Server.MapPath("white.JPG"));
Bitmap bm = new Bitmap(_gifImage.Width, _gifImage.Height,
PixelFormat.Format8bppIndexed);
ColorPalette pal = bm.Palette;
for (int i = 0; i < pal.Entries.Length; i++)
{
Color col = pal.Entries[i];
pal.Entries[i] = Color.FromArgb(0, col.R, col.G, col.B);
}
bm.Palette = pal;
BitmapData src = ((Bitmap)_gifImage).LockBits(new Rectangle
(0, 0, _gifImage.Width, _gifImage.Height), ImageLockMode.ReadOnly,
_gifImage.PixelFormat);
BitmapData dst = bm.LockBits(new Rectangle(0, 0, bm.Width, bm.Height),
ImageLockMode.WriteOnly, bm.PixelFormat);
((Bitmap)_gifImage).UnlockBits(src);
bm.UnlockBits(dst);
Response.ContentType = "image/gif";
bm.Save(Response.OutputStream, ImageFormat.Gif);
bm.Dispose();
_gifImage.Dispose();
Response.Flush();