.NET加水印/驗證碼的NuGet包

  • 2019 年 10 月 3 日
  • 筆記

.NET???/????NuGet? NuGet

????????????????????????Direct2D??????/????????????????????NuGet?Sdcb.Imaging?

<PackageReference Include="Sdcb.Imaging" Version="1.1.0" />

???????????
https://www.nuget.org/packages/Sdcb.Imaging

.NET???????

using (var imageStream = File.OpenRead(@"........sample-imagessrc.png"))  using (var outputStream = File.OpenWrite(@"........sample-imageswatermark-test1.png"))  {      WatermarkTool.WatermarkText(          imageStream, outputStream,          watermark: "Watermark here",          font: "Times New Roman",          fontSize: 30,          colorARGB: 0x7f_FF_FF_FF); // 50% transparent white  }

?????????font???????fontSize?????colorARGB?????????????

??

??????????

?????????

.NET??????

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-imagescaptcha-test1.png", pngBytes);

?????????font???????fontSize?????????lineCount???????????rotation????????turbulenceAmount????????

????????turbulenceAmount????????????????

??????

?????

???

  • ???????????????????????1/??I/????l?

  • ???????????????????L?

  • ?????????????????????????????????


  • ??????????????100????????????

?????
???https://www.cnblogs.com/sdflysha
???? ??????-??????-?????? 2.5 ???????? ???????????????????????????????????????????