https://github.com/zijiren233/go-text2picture
Golang simple text to text to picture
https://github.com/zijiren233/go-text2picture
go golang image picture text-conversion text2image text2picture
Last synced: 11 months ago
JSON representation
Golang simple text to text to picture
- Host: GitHub
- URL: https://github.com/zijiren233/go-text2picture
- Owner: zijiren233
- License: mit
- Created: 2022-08-30T00:52:21.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2022-10-03T12:42:26.000Z (over 3 years ago)
- Last Synced: 2025-03-28T11:39:23.814Z (about 1 year ago)
- Topics: go, golang, image, picture, text-conversion, text2image, text2picture
- Language: Go
- Homepage: https://github.com/zijiren233/go-text2picture
- Size: 4.77 MB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-text2picture
```go
package main
import (
"fmt"
"image/color"
"io"
"os"
"github.com/zijiren233/go-text2picture"
)
func main() {
pic := text2picture.NewPictureWithBackGround(text2picture.NewColorPicture(500, 100, text2picture.White), 320, 10, 5)
pic.DrawWithBlack("test 123\n4321...")
pic.DrawWithColor(text2picture.Red, "test color ... ")
pic.PointOffset(0, float64(pic.NextLineDistance()))
pic.DrawWithBlack("test offset")
pic.DrawWithBlack(" test auto newline")
f, err := os.OpenFile("./test.png", os.O_CREATE|os.O_WRONLY|os.O_TRUNC, os.ModePerm)
if err != nil {
fmt.Println(err)
return
}
defer f.Close()
io.Copy(f, pic.GeneratePicture())
}
```
