1 base.Response.ContentType = "image/jpeg";
2 Bitmap image = new Bitmap(Server.MapPath("2008-12-31.jpg"));
3 Bitmap waterImage = new Bitmap(Server.MapPath("74.png"));
4
5 Graphics graphics = Graphics.FromImage(image);
6 graphics.InterpolationMode = InterpolationMode.High;
7 graphics.SmoothingMode = SmoothingMode.HighQuality;
8 ImageAttributes imageatta = new ImageAttributes();
9 ColorMap colorMap = new ColorMap();
10 colorMap.OldColor = Color.FromArgb(225, 0, 225, 0);
11 colorMap.NewColor = Color.FromArgb(0, 222, 0, 0);
12 ColorMap[] RemapTable = { colorMap };
13 //imageatta.SetRemapTable(RemapTable, ColorAdjustType.Bitmap);
14 float[][] colorMatrixElm = {
15 new float[] {1, 0, 0, 0, 0},
16 new float[] {0, 1, 0, 0, 0},
17 new float[] {0, 0, 1, 0, 0},
18 new float[] {0, 0, 0, 0.5f, 0},
19 new float[] {0, 0, 0, 0, 1}
20 };
21 ColorMatrix colorMatrix = new ColorMatrix(colorMatrixElm);
22 imageatta.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
23 int yPos = 0;
24 int xPos = 0;
25 graphics.DrawImage(waterImage, new Rectangle(xPos, yPos, waterImage.Width, waterImage.Height), 0, 0, waterImage.Width, waterImage.Height, GraphicsUnit.Pixel, imageatta);
26 graphics.Dispose();
27 image.Save(base.Response.OutputStream, ImageFormat.Jpeg);
28 image.Dispose();
29 waterImage.Dispose();
2 Bitmap image = new Bitmap(Server.MapPath("2008-12-31.jpg"));
3 Bitmap waterImage = new Bitmap(Server.MapPath("74.png"));
4
5 Graphics graphics = Graphics.FromImage(image);
6 graphics.InterpolationMode = InterpolationMode.High;
7 graphics.SmoothingMode = SmoothingMode.HighQuality;
8 ImageAttributes imageatta = new ImageAttributes();
9 ColorMap colorMap = new ColorMap();
10 colorMap.OldColor = Color.FromArgb(225, 0, 225, 0);
11 colorMap.NewColor = Color.FromArgb(0, 222, 0, 0);
12 ColorMap[] RemapTable = { colorMap };
13 //imageatta.SetRemapTable(RemapTable, ColorAdjustType.Bitmap);
14 float[][] colorMatrixElm = {
15 new float[] {1, 0, 0, 0, 0},
16 new float[] {0, 1, 0, 0, 0},
17 new float[] {0, 0, 1, 0, 0},
18 new float[] {0, 0, 0, 0.5f, 0},
19 new float[] {0, 0, 0, 0, 1}
20 };
21 ColorMatrix colorMatrix = new ColorMatrix(colorMatrixElm);
22 imageatta.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
23 int yPos = 0;
24 int xPos = 0;
25 graphics.DrawImage(waterImage, new Rectangle(xPos, yPos, waterImage.Width, waterImage.Height), 0, 0, waterImage.Width, waterImage.Height, GraphicsUnit.Pixel, imageatta);
26 graphics.Dispose();
27 image.Save(base.Response.OutputStream, ImageFormat.Jpeg);
28 image.Dispose();
29 waterImage.Dispose();