Dim file As String = "d:\123.jpg"
Dim txt As String = "我是水印文字"
Dim img As image = getImage(file)
Dim bmp = new bitmap(img.Width, img.Height)
Dim g = graphics.fromimage(bmp)
g.DrawImage(img,0,0) ‘绘制原图片’
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality
Dim fnt As new Font("微软雅黑", 60, FontStyle.Bold) ‘水印文字字体
Dim size = g.MeasureString(txt, fnt)
g.TranslateTransform((img.width-size.width)/2, img.Height - size.height - 50) '设置文字的绘制起点
g.RotateTransform(-45) '逆时针旋转45度
Dim semiTransBrush As new System.Drawing.SolidBrush(Color.FromArgb(120, 177, 171, 171)) '水印文字颜色,120是透明度,范围0~255
g.DrawString(txt, fnt, semiTransBrush, new PointF(0,0))
bmp.save("E:\问题\shuiyin.jpg",img.RawFormat)
bmp.Dispose
semiTransBrush.Dispose