python-pillow / python-pillow/Pillow

Identify dominant colors

Open
#4,634 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement
Dominant language
Python
Stars
13.8k
Forks
2.5k
Avg merge
2d 8h
Merged PRs (30d)
89

Description

This is a feature request.

Would it be within the scope of pillow to have a function that identifies dominant colors within an image? The relevant question on StackOverflow has been viewed ~50k times.

One of the suggestions is the colorthief library that identifies an image's palette and dominant colors with only Pillow (and math, but it's not necessary). Could that code be ported to Pillow?

Pillow's own getcolors() doesn't solve the problem.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing Pillow's existing getcolors() behavior and the linked colorthief approach, then compare the requested palette and dominant-color behavior with the StackOverflow example. Done would require an agreed Pillow API, an implementation scope, and tests showing that dominant colors are identified for representative images.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-vision
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.