Skip to content

Instantly share code, notes, and snippets.

@beta-decay
Created July 27, 2017 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beta-decay/fbcdb6626c9ed50529596e78cd6dffc8 to your computer and use it in GitHub Desktop.
Save beta-decay/fbcdb6626c9ed50529596e78cd6dffc8 to your computer and use it in GitHub Desktop.
from PIL import Image
fname = input()
image = Image.open(fname)
pix = image.load()
npixels = image.size[0]*image.size[1]
ncloud = 0
for x in range(image.size[0]):
for y in range(image.size[1]):
col = pix[x,y]
if col[0] >= 192 and col[1] >= 192 and col[2] >= 192:
ncloud += 1
print(ncloud/npixels*100)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment