Documentation ¶
Overview ¶
Package timg allows you to generate an image. Image from a given string. There is no encoding included, so you can define the encoding for the generated image by yourself. You can use a ttf font, which should be loaded into the options as []byte. If you not provide own fonts the gomono font golang.org/x/image/font/gofont/gomono will be used.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Box ¶
type Box struct {
Top, Right, Bottom, Left int
}
Box defines int values for Top, Right, Bottom, Left a little bit similar like in CSS.
type Options ¶
type Options struct { Padding Box // absolute padding of the image Width int // width of the image TType truetype.Options Tpad int // padding for the line height FontColor color.NRGBA Font []byte // TTF font }
Options which let you configure Draw()
func Default ¶
func Default() *Options
Default returns the default options for Draw(). If you want to change some of the default values, you call this function and change just that values.
opt := timg.Default() opt.Width = 5000 img, err := timg.Draw(txt, opt)
It is recomended to get always the default options, because that will decouple your code from that options. When some other options are added in later versions you will get them automatically.