title: How to count number of pixels for specific color from Image Using python
body: <p>I want to calculate the total number of pixels from a image for specific color witch will have all Sade of that specific color for example blue its will check all shade of blue and will return Total count of blue pixels</p>
  <p>What is typed but its checking for blue not for shades of blue</p>
  <pre><code>from PIL import Image
  im = Image.open('rin_test/Images33.png')
  
  black = 0
  red = 0
  
  for pixel in im.getdata():
      if pixel == (30,144,255): # if your image is RGB (if RGBA, (0, 0, 0, 255) or so
          blue += 1
  print('blue=' + str(blue))
  </code></pre>
  <p>Sample Image for blue color
  <a href="https://i.stack.imgur.com/N58Q0.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/N58Q0.png" alt="enter image description here" /></a></p>