https://gitee.com/bangbaoshi/wordcloud
cd $GOPATH/src/gitee.com/bangbaoshi
git clone https://gitee.com/bangbaoshi/wordcloud.git
cd wordcloud
go run boot/main.go
通过以上四步即可在imgs目录中生成文字云图片(查看imgs/out.png)
- boot目录包含测试用例
- fonts目录包含若干种字体(非商业使用)
- imgs目录包含模板图片,文字云生成的效果图就是按照模板图片的样子来生成
boot/main.go中已经简单介绍了使用方法
package main
import (
"image/color"
"gitee.com/bangbaoshi/wordcloud"
)
func renderNow() {
//需要写入的文本数组
textList := []string{"恭喜", "发财", "万事", "如意"}
//文本角度数组
angles := []int{0, 15, -15, 90}
//文本颜色数组
colors := []*color.RGBA{
&color.RGBA{0x0, 0x60, 0x30, 0xff},
&color.RGBA{0x60, 0x0, 0x0, 0xff},
&color.RGBA{0x73, 0x73, 0x0, 0xff},
}
//设置对应的字体路径,和输出路径
render := wordcloud_go.NewWordCloudRender(60, 8,
"./fonts/xin_shi_gu_yin.ttf",
"./imgs/tiger.png", textList, angles, colors, "./imgs/out.png")
//开始渲染
render.Render()
}
func main() {
renderNow()
}
- 使用golang语言实现了文字云算法
- 用golang实现一些有趣的想法
wordcloud-golang's People
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.