zoukankan      html  css  js  c++  java
  • C# 在图片上写字

    下面的代码实现了从剪贴板取出图片,然后写上字,保存到文件

    Image bmap;
    IDataObject data = System.Windows.Forms.Clipboard.GetDataObject();
    bmap = (Image)(data.GetData(typeof(System.Drawing.Bitmap)));
    Graphics g = Graphics.FromImage(bmap); SolidBrush drawBrush = new SolidBrush(Color.Red);
    Font drawFont = new Font("Arial", 10, FontStyle.Bold, GraphicsUnit.Millimeter);
    int xPos = bmap.Height - ( bmap.Height-25 );
    int yPos = 3;
    g.DrawString ("zydzydyzydydydyyydydy", drawFont, drawBrush, xPos, yPos); string sPicPath = "d:\\filename.jpg";string sPreFix = "d:\\xxx"; Image smBmap ; smBmap = bmap.GetThumbnailImage(bmap.Width, bmap.Height, null, System.IntPtr.Zero); smBmap.Save(sPicPath, System.Drawing.Imaging.ImageFormat.Jpeg); bmap.Save(sPreFix + ".jpg", System.Drawing.Imaging.ImageFormat.Jpeg);
    bmap = null;
    smBmap = null;
  • 相关阅读:
    79.Word Search
    78.Subsets
    77.Combinations
    75.Sort Colors
    74.Search a 2D Matrix
    73.Set Matrix Zeroes
    71.Simplify Path
    64.Minimum Path Sum
    63.Unique Paths II
    Docker 拉取 oracle 11g镜像配置
  • 原文地址:https://www.cnblogs.com/flyhigh1860/p/3115871.html
Copyright © 2011-2022 走看看