package freetype import ( "image" "os" _ "image/png" // Add PNG file loading support "golang.org/x/image/draw" "golang.org/x/image/math/fixed" ) const emojiScale = fixed.Int26_6(100) func loadIconAtSize(path string, size fixed.Int26_6) (image.Image, error) { file, err := os.Open(path) if err != nil { return nil, err } defer file.Close() img, _, err := image.Decode(file) if err != nil { return nil, err } scale := size.Mul(emojiScale).Round() scaled := image.NewRGBA(image.Rect(0, 0, scale, scale)) draw.BiLinear.Scale(scaled, scaled.Bounds(), img, img.Bounds(), draw.Over, nil) return scaled, nil }