package main import ( "image" "image/png" "os" "path/filepath" ) func main() { destination := ".local/concurrent.png" if e := os.MkdirAll(filepath.Dir(destination), 0700); e != nil { panic(e) } img := image.NewNRGBA(image.Rect(0, 0, 1024, 1024)) var x uint32 = 0x12345678 for i := 0; i < len(img.Pix); i += 4 { for channel := 0; channel < 3; channel++ { x ^= x << 13 x ^= x >> 17 x ^= x << 5 img.Pix[i+channel] = byte(x) } img.Pix[i+3] = 255 } f, e := os.Create(destination) if e != nil { panic(e) } if e = png.Encode(f, img); e != nil { _ = f.Close() panic(e) } if e = f.Close(); e != nil { panic(e) } }