[Python] Extract all colors from an image using colorgram

Discussão em 'Python' iniciado por Stack, Março 8, 2025.

  1. Stack

    Stack Membro Participativo

    I am willing to get all of the colors present in an image in python using colorgram. In the documentation they don't specifically say about this. Here is my code:

    import colorgram as cg

    color_list = cg.extract("dot-img.jpg", 60)
    color_palette = []

    for count in range(len(color_list)):
    rgb = color_list[count]
    color = rgb.rgb
    color_palette.append(color)


    I wrote 60 in cg.extract second argument. But I don't get 60 colors. Does that mean that colorgram returned me all of the colors present in the image?

    Continue reading...

Compartilhe esta Página