Skip to content

Instantly share code, notes, and snippets.

@GeneralistDev
Created June 12, 2020 20:08
Show Gist options
  • Select an option

  • Save GeneralistDev/93c962047092dad7c28e03f3eb2a0eed to your computer and use it in GitHub Desktop.

Select an option

Save GeneralistDev/93c962047092dad7c28e03f3eb2a0eed to your computer and use it in GitHub Desktop.
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()
print(average_color)
# renderer = ColorRenderer(average_color)
# renderer.render()
WhiteList = [
(255,255,255),
# Add more white shades here
]
for shade in WhiteList:
if average_color == shade:
print("This image has a white average color")
sys.exit(0)
# If we get here it means we didn't find white
print("This image does not have an average white color")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment