(im image.Image)
| 186 | } |
| 187 | |
| 188 | func AverageImageColor(im image.Image) color.NRGBA { |
| 189 | rgba := imageToRGBA(im) |
| 190 | size := rgba.Bounds().Size() |
| 191 | w, h := size.X, size.Y |
| 192 | var r, g, b int |
| 193 | for y := 0; y < h; y++ { |
| 194 | for x := 0; x < w; x++ { |
| 195 | c := rgba.RGBAAt(x, y) |
| 196 | r += int(c.R) |
| 197 | g += int(c.G) |
| 198 | b += int(c.B) |
| 199 | } |
| 200 | } |
| 201 | r /= w * h |
| 202 | g /= w * h |
| 203 | b /= w * h |
| 204 | return color.NRGBA{uint8(r), uint8(g), uint8(b), 255} |
| 205 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…