C图片处理工具类含绘制水印阴影保存等.docxVIP

  • 0
  • 0
  • 约4.01千字
  • 约 5页
  • 2021-01-30 发布于山东
  • 举报

C图片处理工具类含绘制水印阴影保存等.docx

一个 C#写的图片处理基础类,功能包括获取或设置要修改的图像路径、获取或设置在画的图片路径 (水印图片 ) 、获取或设置水印在修改图片中的右边距、获取或设置水印在修改 图片中距底部的高度、获取或设置要绘制水印的透明度 ,注意是原来图片透明度的百分比、 获取或设置要输出图像的路径、 绘制水印、 绘制图形坐标、 绘制阴影图像、 保存文件等功能: view sourceprint?001using System; 002using System.Collections.Generic; 003using System.Linq; 004using System.Text; 005using System.IO; 006using System.Drawing; 007using System.Drawing.Drawing2D; 008using System.Drawing.Imaging; 009namespace CLB.Utility.Tools 010{ 011 public class ImageModification 012 { 013 #region member fields 014 private string modifyImagePath = null; 015 private string drawedImagePath = null; 016 private int rightSpace; 017 private int bottoamSpace; 018 private int lucencyPercent = 70; 019 private string outPath = null; 020 #endregion 021 public ImageModification() { } #region propertys /// /// 获取或设置要修改的图像路径 027 /// 028 public string ModifyImagePath 029 { 030 get { return this.modifyImagePath; } 031 set { this.modifyImagePath = value; } } /// 034 /// 获取或设置在画的图片路径 (水印图片 ) 035 /// 036 public string DrawedImagePath 037 { 038 get { return this.drawedImagePath; } 039 set { this.drawedImagePath = value; } } /// /// 获取或设置水印在修改图片中的右边距 043 /// 044 public int RightSpace 045 { 046 get { return this.rightSpace; } 047 set { this.rightSpace = value; } 048 } //获取或设置水印在修改图片中距底部的高度 050 public int BottoamSpace 051 { 052 get { return this.bottoamSpace; } 053 set { this.bottoamSpace = value; } 054 } 055 /// 056 /// 获取或设置要绘制水印的透明度 ,注意是原来图片透明度的百分比 057 /// 058 public int LucencyPercent 059 { 060 get { return this.lucencyPercent; } set { if (value gt;= 0 amp;amp; value lt;= 100) this.lucencyPercent = value; } } /// /// 获取或设置要输出图像的路径 069 /// 070 public string OutPath 071 { 072 get { return this.outPath; } 073 set { this.outPath = value; } 074 } 075 #endregion 076 #region methods 077 /// 078 /// 开始绘制水印 079 /// 080 public void DrawImage() 081 { 082 Image modifyImage = null; 083 Image drawedImage = null; 084 Graphics g = null; try { //建立图形对象 088 modifyImage = Image.FromFile(this.ModifyImagePath);

文档评论(0)

1亿VIP精品文档

相关文档