Skip to content

Instantly share code, notes, and snippets.

@suzaku
Created March 7, 2016 08:21
Show Gist options
  • Save suzaku/f1c8ef50f88251c6d52d to your computer and use it in GitHub Desktop.
Save suzaku/f1c8ef50f88251c6d52d to your computer and use it in GitHub Desktop.
A function that fill an image with specified background color
func createImage(width int, height int, background color.RGBA) *image.RGBA {
rect := image.Rect(0, 0, width, height)
img := image.NewRGBA(rect)
draw.Draw(img, img.Bounds(), &image.Uniform{background}, image.ZP, draw.Src)
return img
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment