具体大概用法看 ZeroBot-Plugin-Gif:https://github.com/tdf1939/ZeroBot-Plugin-Gif ,里头写了一个 ZeroBot QQ机器人 插件 目前为止有 摸 冲 搓 反色 翻上 灰度 等
需要另外下载素材包配合使用:https://github.com/tdf1939/sucai
新案例:生成随机头像 :https://github.com/tdf1939/ZeroBot-Plugin-picrew
type Dc struct {
Im *image.NRGBA
W int
H int
}
func Load(path string) image.Image {
func ImDc(path string, w, h int) *Dc {
// 加载图片每一帧图片 func ImsDc(path string, w, h int) []*image.NRGBA {
func ImDc(path string, w, h int) *Dc {
func Size(im image.Image, w, h int) *Dc {
func AndW(im []*image.NRGBA) *Dc {
func AndH(im []*image.NRGBA) *Dc {
func Text(font string, size float64, col []int, col1 []int, txt string) *Dc {
func SavePng(im image.Image, path string) {
func FloatUint8(a float64) uint8 {
var White = []int{255, 255, 255, 255}
var Black = []int{0, 0, 0, 255}
var Red = []int{255, 0, 0, 255}
var Green = []int{0, 255, 0, 255}
var Blue = []int{0, 0, 255, 255}
var Yellow = []int{255, 255, 0, 255}
var Cyan = []int{0, 255, 255, 255}
var Magenta = []int{255, 0, 255, 255}
var Grey = []int{190, 190, 190, 255}
var Pink = []int{255, 181, 197, 255}
var Orange = []int{255, 165, 0, 255}
var TouM = []int{0, 0, 0, 0}
func (dst *Dc) Clone() *Dc {
func (dst *Dc) Size(w, h int) *Dc {
func Rotate(img image.Image, angle float64, w, h int) *Dc {
func (dst *Dc) Over(im image.Image, w, h, x, y int) *Dc {
func (dst *Dc) OverC(im image.Image, w, h, x, y int) *Dc {
func (dst *Dc) DstOver(im image.Image, w, h, x, y int) *Dc {
func (dst *Dc) DstOverC(im image.Image, w, h, x, y int) *Dc {
func (dst *Dc) Circle(r int) *Dc {
func (dst *Dc) Clip(w, h, x, y int) *Dc {
func (dst *Dc) ClipCircle(x, y, r int) *Dc {
func (dst *Dc) DstClipCircle(x, y, r int) *Dc {
func (dst *Dc) Text(font string, size float64, col []int, x, y float64, txt string) *Dc {
func (dst *Dc) AdjustBrightness(s float64) *Dc {
func (dst *Dc) AdjustContrast(a float64) *Dc {
func (dst *Dc) AdjustSaturation(a float64) *Dc {
func (dst *Dc) Sharpen(a float64) *Dc {
func (dst *Dc) Blur(a float64) *Dc {
func (dst *Dc) ColSet(a1, a2 color.NRGBA) *Dc {
func (dst *Dc) Grayscale() *Dc {
func (dst *Dc) Invert() *Dc {
func (dst *Dc) Convolve3x3() *Dc {
func GetPaletted(im image.Image) *image.Paletted {
func (dst *Dc) OverG(im []*image.NRGBA, w, h, x, y int) []*image.NRGBA {
func AndGif(delay int, im []*image.NRGBA) *gif.GIF {
func SaveGif(g *gif.GIF, path string) {
func SGpic(s string) string {