VahidN / DNTCaptcha.Core

DNTCaptcha.Core is a captcha generator and validator for ASP.NET Core applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Additional Note : Using System.Drawing in Linux without libgdiplus

miladsoft opened this issue · comments

Using System.Drawing on Linux

Fortunately, now we have a solution. Below we will demonstrate how our .NET Graphics API, Aspose.Drawing for .NET, can help you use System.Drawing in Linux. Using Aspose.Drawing, you can get rid of graphics libraries with native code and have your images look the same on all platforms.

.NET Graphics API – Easy to Install

For installation of Aspose.Drawing on a target Linux machine you just need to have .NET Core installed. Put Aspose.Drawing.dll in your project folder and run the program. That’s all. Now you can use classes in System.Drawing namespace just like you do it from your .NET Framework applications on Windows.

To get Aspose.Drawing binaries, please download the latest version from the official website. Alternatively, you can include the API directly in your project by running the following command.

dotnet add package Aspose.Drawing

No additional components are required. Aspose.Drawing does all the drawing itself without referencing any native library. You will never receive messages like:

Unable to load DLL 'libgdiplus': The specified module could not be found.

And you don’t have to care about the version of the graphics system installed on your platform.

I will not use a commercial library here.

Plus if you want to use another drawing library, you just need to implement the ICaptchaImageProvider service and register it as a singleton before adding services.AddDNTCaptcha. Your custom implementation will be used instead of the original one.

services.AddSingleton<ICaptchaImageProvider, MyCaptchaImageProvider>();
services.AddDNTCaptcha();