Skip to content

Instantly share code, notes, and snippets.

@NetguruGist
Created November 28, 2016 13:33
Show Gist options
  • Save NetguruGist/55b90a1976f05aff210eb57d79e48bf3 to your computer and use it in GitHub Desktop.
Save NetguruGist/55b90a1976f05aff210eb57d79e48bf3 to your computer and use it in GitHub Desktop.
func generateImage(w, h int, pixelColor color.RGBA) *image.RGBA {
img := image.NewRGBA(image.Rect(0, 0, 4, 4))
for x := 0; x < 4; x++ {
for y := 0; y < 4; y++ {
img.Set(x, y, pixelColor)
}
}
return img
}
func randomColor() color.RGBA {
rand := rand.New(rand.NewSource(time.Now().Unix()))
return color.RGBA{uint8(rand.Intn(255)), uint8(rand.Intn(255)), uint8(rand.Intn(255)), 255}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment