Introduce ImageColors

Authored by mart on May 12 2020, 9:37 AM.

Description

Introduce ImageColors

Summary:
ImageColors is a class to extract color statistics out of an image. it supports
as source :

  • Grabbing a static frame out of any Item
  • A QImage or a QIcon (for instance coming from a QAbstractItemModel
  • An icon name from the theme

By a pixel-by pixel analisys it uses a K-means clustering algorythm
https://en.wikipedia.org/wiki/K-means_clustering
that groups averages of colors group that have a computed "distance" less than an
arbitrary value and so extracts a palette of the "dominant" colors of the image,
having also other imformations such as the % occurrence of each cluster, a
complementary color for each cluster, the global average color, the most
"vibrant" color of the image, usable as an accent, and good colors for text and
background, based on the extracted palette

Test Plan:



Reviewers: Kirigami, cblack

Reviewed By: cblack

Subscribers: cblack, plasma-devel

Tags: Kirigami

Differential Revision: https://phabricator.kde.org/D29637

Details

Committed
martMay 14 2020, 8:37 AM
Reviewer
cblack
Differential Revision
D29637: Introduce ImageColors
Parents
R169:f1a2c678f9bd: Recommend better width calculation for PlaceholderMessage
Branches
Unknown
Tags
Unknown