ExNihilo is a modern, powerful and flexible text captcha generator library for .NET.
$ dotnet add package ExNihilo
This is an extremely powerful tool for creating procedural images from scratch. You can use it to generate captchas, datasets to train neural networks or unique game mechanics - in other words, for anything your imagination can do
For detailed illustrated code examples, we recommend you go to the Wiki section. However, here is a sample:
var fontFamily = new FontCollection()
.AddSystemFonts()
.GetByCulture(CultureInfo.CurrentCulture)
.First();
Size containerSize = new(512, 256);
Container container = new(containerSize)
.WithContainer(
new Container(containerSize)
.WithBackground(Color.White)
.WithVisual(
new Text()
.WithPoint(new Point(256,128))
.WithFontSize(100)
.WithRandomizedContent(content => {
content.WithLength(5);
content.WithCharactersSet(StringProperty.asciiUpperCase);
})
.WithRandomizedBrush(10)
.WithFontFamily(fontFamily)
.WithType(ExNihilo.Utils.VisualType.Filled)
)
);
new ImageSaver(
new ImageGenerator(container)
.WithSeedsCount(3)
.Generate())
.WithOutputPath("./")
.CreateFolder("Results")
.Save();
You can always find several test projects with detailed code explanations in a directory /examples:
| Project | Description | Result |
|---|---|---|
| Simple | The example shows basic container operations such as working with containers, text, generating and saving an image. | ![]() |
| AdvancedCaptcha | Advanced work with multiple visual objects, randomization of their parameters and post-processing effects. | ![]() |
| TwoLanguage | This example shows how to create a image with different fonts for rendering text in two languages. | ![]() |
| WPF | This example shows how to create and display image in WPF project. |
ExNihilo is licensed under the Apache License, Version 2.0 The licenses of the used libraries can be found here