Skip to content

Latest commit

 

History

History
50 lines (38 loc) · 2.36 KB

README.md

File metadata and controls

50 lines (38 loc) · 2.36 KB

CaptchaN

Image Demo

Generate captcha images based on ImageSharp and .NET.

基于ImageSharp项目和.NET,生成图形验证码。

.NET 8 License

Packages |Nuget包

Name Description NugetPackage
CaptchaN Core module CaptchaN
CaptchaN.DI.Microsoft DI module for default container CaptchaN.DI.Microsoft

QuickStart |快速入门

The following is main codes for basic usage.

// Load or install fonts(*.ttf) which are provided by yourself
IFontRandomerFactory fontRandomerFactory = new ...;
IFontRandomer fontRandomer = fontRandomerFactory.CreateFontRandomer();
// Init color randomer
IColorRandomer colorRandomer = new ...;
IPainter painter = new Painter(fontRandomer, colorRandomer);
// Init the content settings for images
PainterOption painterOption = new(){...};
// Optional. Generate random text for solid length
ICodeTextGenerator codeTextGenerator = new ...;
string codeText = codeTextGenerator.Generate(4);
// Generate an image
await painter.GenerateImageAsync(codeText, painterOption);

Please see Wiki and Samples for details.

Contribution |贡献

Issues and pull requests are welcomed if you have any questions!

如果您有任何疑问,欢迎提交Issue和PR!