package main import ( "fmt" "image/png" "os" ) func main() { file, err := os.Open("test.png") if err != nil { panic(err) } defer file.Close() image, err := png.Decode(file) if err != nil { panic(err) } fmt.Println(image) }