package application import ( "bytes" "image" "image/draw" "image/png" ) func pngToImage(data []byte) (*image.RGBA, error) { img, err := png.Decode(bytes.NewReader(data)) if err != nil { return nil, err } bounds := img.Bounds() rgba := image.NewRGBA(bounds) draw.Draw(rgba, bounds, img, bounds.Min, draw.Src) return rgba, nil }