0

I know that 'meanColor()' prints the values of BGR, but how can I individually get those values?

For example:

img = "picture"

colors = img.meanColor()

print(colors)

And I get something like this (30,10,40)

Let say I want the 30.

How can I assign it on another variable?

Please explain your solution.

Thanks

Jcorretjer
  • 467
  • 2
  • 6
  • 24

1 Answers1

1

It's a tuple, so you can go like :

blue  = colors[0]
green = colors[1]
red   = colors[2]  
#or
b, g, r = colors
OneOfOne
  • 95,033
  • 20
  • 184
  • 185