Extract colors from images and attach them as swatches. See an example here.
Takes one argument: number_of_color_clusters (int), which is pretty self-explanatory. No? Okay, it means how many color clusters (e.g. reddish colors, bluish colors, etc.) to return and add to the swatches.
Usage:
input_path = "input_image.jpg"
output_path = "output_image.jpg"
colorgrammed_image = create(image_path=input_path, number_of_color_clusters=10)
cv2.imwrite(output_path, colorgrammed_image)
PS: I owe a debt to various places where I learned how to do this and copied some code snippets. I don't remember them all but now wish I did. If you recognize this as something you've worked on, and want credit, please let me know as I'm happy to give it!