var info = new FileInfo(file);
var name = info.Name;
Image Im = Image.FromFile(file);
Graphics g = Graphics.FromImage(Im);
// Create a solid brush to write the watermark text on the image
Brush myBrush = new SolidBrush(Color.FromArgb(1, Color.LightSteelBlue));
var f = new Font(FontFamily.GenericSerif, 1);
g.DrawString(".", f, myBrush, new Point(1, 1));
if (!Directory.Exists(dir))
{
Directory.CreateDirectory(dir);
}
Im.Save(Path.Combine(dir, name), ImageFormat.Jpeg);//save image with dynamic watermark
c#给图片加水印
最新推荐文章于 2024-08-28 09:45:19 发布