https://github.com/woctezuma/steam-palette-extractor
Find the dominant / most common colors in game banners on the Steam store.
https://github.com/woctezuma/steam-palette-extractor
color-palette color-scheme color-schemes dominant-color dominant-colors dominant-colours palette palette-color palette-colors palette-extraction palette-generation palette-generator palette-similarity palette-sorting palettes palettes-ordering palettes-sorting steam steam-game steam-games
Last synced: 4 months ago
JSON representation
Find the dominant / most common colors in game banners on the Steam store.
- Host: GitHub
- URL: https://github.com/woctezuma/steam-palette-extractor
- Owner: woctezuma
- License: mit
- Created: 2023-12-27T16:10:20.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-13T23:26:59.000Z (4 months ago)
- Last Synced: 2025-01-14T00:25:56.948Z (4 months ago)
- Topics: color-palette, color-scheme, color-schemes, dominant-color, dominant-colors, dominant-colours, palette, palette-color, palette-colors, palette-extraction, palette-generation, palette-generator, palette-similarity, palette-sorting, palettes, palettes-ordering, palettes-sorting, steam, steam-game, steam-games
- Language: Python
- Homepage:
- Size: 131 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Steam Palette Extractor
This repository contains Python code to find the dominant / most common colors in Steam banners.
![Illustration cover][img-cover]
## Usage
Run [`extract_steam_palette.ipynb`][colab-notebook]
[![Open In Colab][colab-badge]][colab-notebook]## Approach
A palette is an ordered list of N colors.
In our case, N is arbitrarily set to 8.We consider:
- a source palette, typically the palette of the gift wrapping,
- a database of target palettes, typically the palettes of every Steam game.### Match colors
In order to match palettes, we first need to be able to match colors.
Colors can be represented in the following spaces:
- RGB,
- HSV:
- raw,
- linearized,
- CIE LAB,
- CIE LUV.The distance between colors is the L2 norm in this space.
It is possible to take into account:
- the index of the color in the target palette,
- the difference between the indices of the colors in the source and target palettes.The objective is to incentivize the matching to colors which are respetively:
- predominant in the target palettes, i.e. with low indices,
- at lease more predominant in the target than in the source palette, i.e. with lower indices.In the latter case, thresholds can be used in order not to distinguish between target colors which have an index lower than the color in the source palette.
### Match palettes
The distance between palettes can be:
- the Mean Pairwise Distance,
- the Hausdorff distance,
- a modified Hausdorff "distance",
- a custom Hausdorff distance, similar to Minimum Color Difference.It is possible to take into account:
- the index of the color in the source palette.The objective is to re-weigh the color distances in order to give more importance to the errors for colors which are predominant in the **source** palette.
The weights can be normalized so that they sum to 1, as the idea is only to re-balance the terms in the error.As with the matching of colors, it is possible to take into account:
- the index of the color in the target palette,
- the difference between the indices of the colors in the source and target palettes.Here, in contrast to what was done with the matching of colors, the idea is to penalize rather than incentivize.
As with the matching of colors, thresholds can be used for more subtle touches.
## Results
A benchmark of the parameters used for the palette distance is shown [on the Wiki][benchmark-wiki].
## References
- [`woctezuma/steam-popular-appids`][steam-popular-appids]: popular Steam appIDs,
- [`woctezuma/steam-store-snapshots`][steam-store-snapshots]: a comprehensive list of appIDs downloaded in January 2021,
- [Stack Overflow][stackoverflow]: different approaches to extract the palette of an image.
- Compare colors:
- Wikipedia: [Red, Green, Blue (RGB)][wiki-rgb]
- Wikipedia: [Hue, Saturation, Value (HSV)][wiki-hsv] **Caveat**: this is a cylindrical-coordinate representation!
- Wikipedia: [CIELAB color space (L\*a\*b\*)][wiki-cielab]
- Wikipedia: [CIELUV color space (L\*u\*v\*)][wiki-cieluv]
- Compare palettes, i.e. **ordered** lists of a few colors:
- Mean Pairwise Distance [1, 2]
- Wikipedia: [Hausdorff distance][wiki-hausdorff] [2]
- Wikipedia: [Modified Hausdorff "distance" (MHD)][wiki-hausdorff-modified] [2, 3] (in French):
- which is a modification where the **sup** is replaced by an **average**,
- which is not actually a distance as it does not exhibit the triangle inequality property,
- Minimum Color Difference (MCD) [1, 2]:
- which is a modification of the Hausdorff distance where the **sup and max** are replaced by an **average**,
- In retrospect, in my code, the distance between palettes is assessed by:
- a modification of the Hausdorff distance where the **sup and max** are replaced by a (weighted) **sum**,
- **NB**: Using a sum or an average is equivalent if the number of colors in each palette, i.e. the cardinality of each set, is constant.
- **NB²**: The weights allow to take advantage of the **order** of colors in the palettes. If one of `exponent` and `factor` is equal to 0, then the weights are all equal to 1, i.e. the weighted sum is simply a sum.
- Articles:
- [1] Pan, Qianqian, et al. [*Comparative Evaluation of Color Differences between Color Palettes*][paper-pan]. Color and Imaging Conference 2018.
- [2] Kim, Suzi, et al. [*Dynamic Closest Color Warping to Sort and Compare Palettes*][paper-DCCW]. [SIGGRAPH][siggraph-DCCW] 2021. ([code][github-DCCW])
- [3] Dubuisson, M-P., et al. [*A modified Hausdorff distance for object matching*][paper-mhd]. ICPR 1994.[img-cover]:
[colab-notebook]:
[colab-badge]:
[benchmark-wiki]:
[steam-popular-appids]:
[steam-store-snapshots]:
[stackoverflow]:
[wiki-rgb]:
[wiki-hsv]:
[wiki-cielab]:
[wiki-cieluv]:
[wiki-hausdorff]:
[wiki-hausdorff-modified]:
[paper-pan]:
[paper-DCCW]:
[siggraph-DCCW]:
[github-DCCW]:
[paper-mhd]: