Skip to content

yujiahaol68/captchy

Repository files navigation

Package captchy

build Go Report Card GoDoc

import "github.com/yujiahaol68/captchy"

captchy implements a abundant CAPTCHAs image generation through flexible config

Split and rotate subImage to against OCRs

Support custom TTF font file or Go builtin fonts

Support export to Base64, PNG, JPEG image

Only std lib so it is clean

API is still not stable. Not recommend for using in production env !

Preview

Generate from very simple to very complex captcha especially for machine, but still friendly to human

simple-captcha-png

complex-captcha-jpg

complex-captcha-png

Usage

Initialize resource

// Load fonts and setup default config
captchy.New(captchy.Default())

Gen solution

rbs := captchy.RandomString()
// Then hash and save rbs into session by yourself
// ..

Gen Image

encoder := captchy.GenerateImg(rbs)
// encoder can encode image into io.Writer, and write it anywhere you prefer.
// It can be local file writer or http response writer
// ..

Reference

DESIGNING CAPTCHA ALGORITHM: SPLITTING AND ROTATING THE IMAGES AGAINST OCRs

About

Go package captchy implements flexible generation of image CAPTCHAs.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages