Skip to content

a simple capture implementation 一个简易的图片验证码实现

License

Notifications You must be signed in to change notification settings

NanoRed/capture

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

capture

a simple capture implementation
一个简易的图片验证码实现

Usage

package main

import (
    "os"
    "fmt"
    "image/color"
    "github.com/RedAFD/capture"
    "github.com/RedAFD/capture/attribute"
    "github.com/RedAFD/capture/wrapper"
)

func main() {
    // create a new capture
    c, err := capture.New()
    if err != nil {
        os.Exit(-1)
    }
    fmt.Println(c) // you can print capture data like this

    // you can reload the capture object like this
    err = c.Reload()
    if err != nil {
        os.Exit(-1)
    }

    // or you can create a custom capture
    c, err = capture.New(&attribute.Attributes{
        Width:           176,
        Height:          72,
        FontFile:        "/user/local/share/xxx.ttf",
        FontSize:        50,
        FontHandler:     nil, // not necessary, it will automatically generated by FontFile
        CharCount:       4,
        CharColor:       color.RGBA{0x00, 0x00, 0x00, 0xff},
        BackGroundColor: color.RGBA{0xff, 0xff, 0xff, 0xff},
        Wrapper:         wrapper.DefaultWrapper, // or you can write your own wrapper
    })
    if err != nil {
        os.Exit(-1)
    }
}

About

a simple capture implementation 一个简易的图片验证码实现

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages