Advertisement
Guest User

Untitled

a guest
Jul 28th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.33 KB | None | 0 0
  1. from PIL import Image
  2.  
  3. fname = input()
  4.  
  5. image = Image.open(fname)
  6. pix = image.load()
  7.  
  8. npixels = image.size[0]*image.size[1]
  9. ncloud = 0
  10.  
  11. for x in range(image.size[0]):
  12. for y in range(image.size[1]):
  13. col = pix[x,y]
  14. if col[0] >= 192 and col[1] >= 192 and col[2] >= 192:
  15. ncloud += 1
  16.  
  17. print(ncloud/npixels*100)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement