Created
June 13, 2020 14:54
-
-
Save GeneralistDev/6326b21c534dc91ddc786ab58f877f2a to your computer and use it in GitHub Desktop.
Just some basic logic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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