qTipTip / Pylette

A Python library for extracting color palettes from supplied images.
https://qtiptip.github.io/Pylette/
MIT License
108 stars 11 forks source link

Incorrect color frequencies when using Median Cut extraction #27

Closed qTipTip closed 4 months ago

qTipTip commented 5 months ago

We're expecting all color frequencies in an image to sum to one. However, currently the median cut algorithm does not uphold this invariant.

FAILED tests/integration/test_colorspaces.py::test_palette_invariants_with_image_path[MC-5] - AssertionError: 
FAILED tests/integration/test_colorspaces.py::test_palette_invariants_with_image_path[MC-10] - AssertionError: 
FAILED tests/integration/test_colorspaces.py::test_palette_invariants_with_image_path[MC-100] - AssertionError: 
E           AssertionError: 
E           Items are not equal to 7 significant digits:
E           Expected the sum of all frequencies to be 1.0
E            ACTUAL: 0.12362117134435475
E            DESIRED: 1.0