package profilepictures import ( "fmt" "image" "image/color" "image/draw" "github.com/fogleman/gg" "golang.org/x/image/font" "golang.org/x/image/math/fixed" ) func DefaultProfilePicture(initials string) *image.RGBA { img := image.NewRGBA(image.Rect(0, 0, 300, 300)) col := color.RGBA{36, 56, 135, 255} white := color.RGBA{255, 255, 255, 255} point := fixed.Point26_6{fixed.I(40), fixed.I(200)} draw.Draw(img, img.Bounds(), &image.Uniform{col}, image.Point{X: 0, Y: 0}, draw.Src) ff, err := gg.LoadFontFace("themes/default/web/fonts/bitter.ttf", 150.0) if err != nil { fmt.Println(err) return img } d := &font.Drawer{ Dst: img, Src: image.NewUniform(white), Face: ff, Dot: point, } d.DrawString(initials) return img }