Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.