Skip to content

Instantly share code, notes, and snippets.

@GeneralistDev
Created June 13, 2020 14:54
Show Gist options
  • Select an option

  • Save GeneralistDev/6326b21c534dc91ddc786ab58f877f2a to your computer and use it in GitHub Desktop.

Select an option

Save GeneralistDev/6326b21c534dc91ddc786ab58f877f2a to your computer and use it in GitHub Desktop.
Just some basic logic
if __name__ == "__main__":
if (len(sys.argv) != 2): # Checks if image was given as cli argument
print("error: syntax is 'python main.py /example/image/location.jpg'")
else:
BackgroundColor = BackgroundColorDetector(sys.argv[1])
average_color = BackgroundColor.detect()
WhiteList = [
(255, 255, 255),
#... The rest of the shades
]
MatchedWhite = False
for shade in WhiteList:
if average_color == shade:
MatchedWhite = True
break
if MatchedWhite:
print ("Background was white")
else:
print ("Background was not white")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment