Open walduino opened 4 months ago
I hope someone finds this usefull, nut sure if i should make a PR...
Be sure to make a PR, the feature is cool. And if you can combine it with a feature request https://github.com/chazzu/hass-animated-scenes/issues/47 in the style of Philips Hue, then it will be just a great feature. That is, you upload a photo, your script analyzes the colors, and creates a card \ entity in the HA UI, which consists of the photo itself, the colors that will be used in Animated Scenes in the form of circles or some other representation to show the color weight for the scene, and the values themselves somehow written to RGB Selectors, which are then passed to Animated Scenes.
For the user experience, it would be cool if the integration allowed you to simply create color profiles from user images, and then just as easily select them in scripts \ automation \ creation of an animation device.
Not an issue actually.... I've put together a python script to help put together a "scene" ; The script analyzes an image to find the most prominent colors and their weights. It filters out colors with a value below 50 or a saturation below 30 (in HSV), sorts the remaining colors by their hue,.
The filtered and sorted color information is printed in a formatted output, that should match the input expected by the animated scenes integration.
It also generates an image with color blocks proportional to the weights of the prominent colors,just to give you an idea what it will look like.
I hope someone finds this usefull, nut sure if i should make a PR...
USAGE
./coloranalysis_animated_scenes.py ./powders.jpeg 20
this wil analyse an image calledpowders.jpg
and will return a config for the 20 most prominent colors. It will also create an image like this:SCRIPT