文件名称:.NET加水印/验证码的NuGet包
文件大小:17KB
文件格式:NUPKG
更新时间:2022-08-21 04:16:01
.NET加水印 验证码 C#水印 C#验证码
给图片加水印 using (var imageStream = File.OpenRead(@"..\..\..\..\sample-images\src.png")) using (var outputStream = File.OpenWrite(@"..\..\..\..\sample-images\watermark-test1.png")) { WatermarkTool.WatermarkText( imageStream, outputStream, watermark: "Watermark here", font: "Times New Roman", fontSize: 30, colorARGB: 0x7f_FF_FF_FF); // 50% transparent white } 创建验证码 byte[] pngBytes = CaptchaTool.CreatePngImage( width: 200, height: 100, text: "CAPTCHA", font: "Times New Roman", fontSize: 50.0f, lineCount: 5, rotation: false, turbulenceAmount: 60.0f); File.WriteAllBytes( @"..\..\..\..\sample-images\captcha-test1.png", pngBytes);