{"id":16990429,"url":"https://github.com/aliasadidev/sixlaborscaptcha","last_synced_at":"2025-03-22T15:30:55.623Z","repository":{"id":42629505,"uuid":"296826143","full_name":"aliasadidev/SixLaborsCaptcha","owner":"aliasadidev","description":"Generate captcha with SixLabors' libraries on .NET Core ","archived":false,"fork":false,"pushed_at":"2024-03-19T21:04:51.000Z","size":113,"stargazers_count":49,"open_issues_count":1,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T13:15:42.959Z","etag":null,"topics":["asp-net-core","aspnetcore","captcha","docker","dotnet-standard","linux-app","windows-app"],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/SixLaborsCaptcha.Core","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aliasadidev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null},"funding":{"github":"aliasadidev"}},"created_at":"2020-09-19T08:52:10.000Z","updated_at":"2024-12-12T08:54:34.000Z","dependencies_parsed_at":"2024-03-19T22:25:14.247Z","dependency_job_id":"6d9c19b5-7a95-4bc1-b0c3-1a6cba976df6","html_url":"https://github.com/aliasadidev/SixLaborsCaptcha","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliasadidev%2FSixLaborsCaptcha","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliasadidev%2FSixLaborsCaptcha/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliasadidev%2FSixLaborsCaptcha/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aliasadidev%2FSixLaborsCaptcha/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aliasadidev","download_url":"https://codeload.github.com/aliasadidev/SixLaborsCaptcha/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244978490,"owners_count":20541861,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asp-net-core","aspnetcore","captcha","docker","dotnet-standard","linux-app","windows-app"],"created_at":"2024-10-14T03:10:01.582Z","updated_at":"2025-03-22T15:30:55.152Z","avatar_url":"https://github.com/aliasadidev.png","language":"C#","funding_links":["https://github.com/sponsors/aliasadidev"],"categories":[],"sub_categories":[],"readme":"# SixLaborsCaptcha\nSixLaborsCaptcha is a simple cross-platform NuGet package for generating image captcha.\n\n## Features\n\n- Simple \u0026 Cross-Platform\n- Compatible with Linux and Windows\n- Compatible with Docker images based on Linux :)\n\n\n# What's New\n\n## Version 1.0.0 - March 13, 2024\n#### Update\n* Upgrade SixLabors.ImageSharp.* packages \n* Drop support of .net standard\n* Support .net 8\n\n## Version 0.2.2 - Sep 26, 2022\n#### Fix\n* Fixed a bug in draw lines feature\n\n## Version 0.2.1 - Jul 22, 2022\n#### Add\n* Add BackgroundColor option\n#### Fix\n* Fixed a typo (`Extentions` renamed to Extensions)\n\n\n## Version 0.2.0 - Apr 22, 2022\n#### Change\n* Upgrade SixLabors.ImageSharp to 2.1.1\n*  **⚠ WARNING: This version incompatible with the previous version of SixLabors.ImageSharp 1.0.0+** \n## Version 0.1.5 - Mar 30, 2022\n#### Fix\n* Update readme file\n## Version 0.1.4 - Mar 30, 2022\n#### Fix\n* Use DrawLinesColor instead of TextColor in creating random lines (#2 by @NK201)\n\n## Version 0.1.3 - Oct 8, 2021\n#### Add\n* Add NoiseRateColor/NoiseRate options\n* Add MinLineThickness/MaxLineThickness options\n#### Change\n* Improve the rendering speed\n* Improve the captcha image security\n\n\n## Packages\n\n| Package                   | Description                                         |\n| ------------------------- | --------------------------------------------------- |\n| SixLaborsCaptcha.Core     | Using for ConsoleApp, WebAPI, WinForms, and etc..   |\n| SixLaborsCaptcha.Mvc.Core | Using for ASP.NET MVC Core and ASP.NET Web API Core |\n\n## SixLaborsCaptchaOptions\n\n| Property           | Description                                                                                                  |\n| ------------------ | ------------------------------------------------------------------------------------------------------------ |\n| FontFamilies       | Characters fonts, default is \"Arial\", \"Verdana\", \"Times New Roman\"                                           |\n| TextColor          | Characters colors, default is { Color.Blue, Color.Black, Color.Black, Color.Brown, Color.Gray, Color.Green } |\n| DrawLinesColor     | Line colors, default is { Color.Blue, Color.Black, Color.Black, Color.Brown, Color.Gray, Color.Green }       |\n| Width              | Width of image box, default is 180                                                                           |\n| Height             | Height of image box, default is 50                                                                           |\n| FontSize           | Font size, default is 29                                                                                     |\n| FontStyle          | Font Style: Regular,Bold,Italic,BoldItalic                                                                   |\n| EncoderType        | Result file formant: Jpeg,Png                                                                                |\n| DrawLines          | Draw the random lines, default is 5                                                                          |\n| MaxRotationDegrees | Rotation degrees, default is 5                                                                               |\n| MinLineThickness   | Min Line Thickness, default is 0.7f                                                                          |\n| MaxLineThickness   | Max Line Thickness, default is 2.0f                                                                          |\n| NoiseRate          | Noise Rate, default is 800                                                                                   |\n| NoiseRateColor     | Noise colors, default is { Color.Gray }                                                                      |\n| BackgroundColor    | Background colors, default is { Color.White }                                                                |\n\n **FontFamilies Option**:\n `Notice: This default fonts working only on Windows, if you want to run it on Linux you have to use the Linux fonts`\n\n## Install via CLI\n\n### To install SixLaborsCaptcha.Core, run the following command in the terminal: ###\n\n```\n\u003e dotnet add package SixLaborsCaptcha.Core --version 1.0.0\n```\n\n## Usage:\n```csharp\nusing SixLaborsCaptcha.Core;\nusing SixLabors.ImageSharp;\nusing System.IO;\n\nnamespace ConsoleAppSample\n{\n\tclass Program\n\t{\n\t\tstatic void Main(string[] args)\n\t\t{\n\t\t\tvar slc = new SixLaborsCaptchaModule(new SixLaborsCaptchaOptions\n\t\t\t{\n\t\t\t\tDrawLines = 7,\n\t\t\t\tTextColor = new Color[] { Color.Blue, Color.Black },\n\t\t\t});\n\n\t\t\tvar key = Extensions.GetUniqueKey(6);\n\t\t\tvar result = slc.Generate(key);\n\t\t\tFile.WriteAllBytes($\"six-labors-captcha.png\", result);\n\t\t}\n\t}\n}\n\n```\n![result](https://raw.githubusercontent.com/aliasadidev/SixLaborsCaptcha/master/samples/images/six-labors-captcha-3.png?raw=true \"six-labors-captcha\")\n\n\n### To install SixLaborsCaptcha.Mvc.Core for ASP.NET Core MVC, run the following command in the Terminal: ###\n```\n\u003e dotnet add package SixLaborsCaptcha.Mvc.Core --version 1.0.0\n```\n## Usage:\n1. In the ConfigureServices method of Startup.cs, register the AddSixLabCaptcha generator\n\n```csharp\nusing SixLaborsCaptcha.Mvc.Core;\n...\n\t\tpublic void ConfigureServices(IServiceCollection services)\n\t\t{\n\t\t\tservices.AddSixLabCaptcha(x =\u003e\n\t\t\t{\n\t\t\t\tx.DrawLines = 4;\n\t\t\t});\n\t\t}\n...\n```\n2. Create an action to generate image\n```csharp\nusing SixLaborsCaptcha.Core;\n...\n\n[HttpGet]\n[Route(\"[action]\")]\npublic FileResult GetCaptchaImage([FromServices] ISixLaborsCaptchaModule sixLaborsCaptcha)\n{\n\tstring key = Extensions.GetUniqueKey(6);\n\tvar imgText = sixLaborsCaptcha.Generate(key);\n\treturn File(imgText, \"Image/Png\");\n}\n\n...\n```\n3. Get the image from action\n```html\n\u003cdiv class=\"text-center\"\u003e\n\t\u003ch1 class=\"display-4\"\u003eWelcome to SixLaborsCaptcha\u003c/h1\u003e\n\t\u003cimg src='@Url.Action(\"GetCaptchaImage\",\"Home\")?v1' /\u003e\n\t\u003cbr /\u003e\n\t\u003cimg src='@Url.Action(\"GetCaptchaImage\",\"Home\")?v2' /\u003e\n\t\u003cbr /\u003e\n\t\u003cimg src='@Url.Action(\"GetCaptchaImage\",\"Home\")?v3' /\u003e\n\t\u003cbr /\u003e\n\t\u003cimg src='@Url.Action(\"GetCaptchaImage\",\"Home\")?v4' /\u003e\n\u003c/div\u003e\n```\n![result](https://raw.githubusercontent.com/aliasadidev/SixLaborsCaptcha/master/samples/images/six-labors-captcha-1.png?raw=true \"six-labors-captcha\")\n![result](https://raw.githubusercontent.com/aliasadidev/SixLaborsCaptcha/master/samples/images/six-labors-captcha-2.png?raw=true \"six-labors-captcha\")\n![result](https://raw.githubusercontent.com/aliasadidev/SixLaborsCaptcha/master/samples/images/six-labors-captcha-4.png?raw=true \"six-labors-captcha\")\n![result](https://raw.githubusercontent.com/aliasadidev/SixLaborsCaptcha/master/samples/images/six-labors-captcha-5.png?raw=true \"six-labors-captcha\")\n\n\n### Run asp.net core mvc app on Linux os: ###\n1. Download a font (also, you can use the system fonts and don't needs to do this step)\n```\nwget -O ~/Downloads/marlboro.zip https://www.1001freefonts.com/d/3761/marlboro.zip\nunzip -p ~/Downloads/marlboro.zip Marlboro.ttf \u003e ~/Downloads/Marlboro.ttf\nrm ~/Downloads/marlboro.zip\ncp ~/Downloads/Marlboro.ttf ~/.fonts/\n# other paths\n# ~/.fonts/ - for your own fonts.\n# /usr/local/share/fonts/ - system-wide, user installed fonts.\n# /usr/share/fonts/ - system's font location.\n```\n2. Config the serivce\n```csharp\n\nservices.AddSixLabCaptcha(x =\u003e {\n\t\t\t   x.FontFamilies = new string[] { \"Marlboro\" };\n\t\t         });\n```\n![linux-result](https://raw.githubusercontent.com/aliasadidev/SixLaborsCaptcha/master/samples/images/six-labors-captcha-6.png?raw=true \"six-labors-captcha-linux\")\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faliasadidev%2Fsixlaborscaptcha","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faliasadidev%2Fsixlaborscaptcha","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faliasadidev%2Fsixlaborscaptcha/lists"}