Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Meme ¶
type Meme struct { // The gif.GIF for the image Gif *gif.GIF // TextBoxes to add TextBoxes *[]TextBox // Border (fraction of image size) Border float64 }
Meme is a structure describing a meme
func MemeFromFile ¶
MemeFromFile initiates a simple meme from a gif
func (*Meme) NormalizeImage ¶
func (m *Meme) NormalizeImage()
NormalizeImage modifies the image it so that it has all frames of the same size, with transparency.
type MemeTemplate ¶
type MemeTemplate struct {
// contains filtered or unexported fields
}
MemeTemplate represents all the basic information you need to generate a meme: the base image and the position, shape and font sizes in the text boxes.
func SimpleTemplate ¶
func SimpleTemplate(imgPath string, fontName string, maxFontSize float64, minFontSize float64) (*MemeTemplate, error)
SimpleTemplate generates the simplest possible template: - one box in the top 1/3rd of the image - one box in the bottom 1/3rd of the image
type TextBox ¶
type TextBox struct { // Text to write in the textbox Txt *string // Width of the textbox, in pixels Width int // Height of the textbox Height int // Position of the textbox in the image Center image.Point // Path to the font FontPath string // Line spacing (fraction of the fontsize) LineSpacingRatio float64 // the actual font size. FontSize float64 }
TextBox represents a text box to add to the image.
func (*TextBox) CalculateFontSize ¶
CalculateFontSize calculates the maximum font size that can fit the text in the textbox.
Click to show internal directories.
Click to hide internal directories.