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();
  • 相关阅读:
    之前总结的,现在要找工作了,给大家分享一下
    numpy总结
    django知识分支_1
    Django小总结
    ORM
    百度在线编辑器 配置修改
    百度在线编辑器
    TP5 路由使用
    cache 订单队列
    绘制静态地图API-高德地图
  • 原文地址:https://www.cnblogs.com/byxxw/p/1355848.html
Copyright © 2011-2022 走看看