zoukankan      html  css  js  c++  java
  • C#水印

     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(22502250);
    11        colorMap.NewColor = Color.FromArgb(022200);
    12        ColorMap[] RemapTable = { colorMap };
    13        //imageatta.SetRemapTable(RemapTable, ColorAdjustType.Bitmap);
    14        float[][] colorMatrixElm = {
    15            new float[] {10000},
    16            new float[] {01000},
    17            new float[] {00100},
    18            new float[] {0000.5f0}
    19            new float[] {00001}
    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), 00, waterImage.Width, waterImage.Height, GraphicsUnit.Pixel, imageatta);
    26        graphics.Dispose();
    27        image.Save(base.Response.OutputStream, ImageFormat.Jpeg);
    28        image.Dispose();
    29        waterImage.Dispose();
  • 相关阅读:
    js 鼠标事件大全
    ASP.NET 解决重复提交问题
    C# 统计函数运行时间
    DataGrid 、Repeater、DataList、GridView自动编号列
    两种时间格式正则表达式HH:mm 和HH:mm:ss
    SQL Server2008 新语法
    XYTipsWindow 2.8
    MSSQL 清空日志
    SQL 日期格式化大全
    HDOJ 2132
  • 原文地址:https://www.cnblogs.com/byxxw/p/1355848.html
Copyright © 2011-2022 走看看