This is a tool to generate cool instagram story sized graphics for song tops and highlights.
The tool produces your graphic through the following steps:
- Searches for the song using the Spotify API
- Downloads the album art
- Performs color preprocessing (changes color space)
- Performs K-Means clustering to find dominant colors
- Generates a graphic using a gradient of dominant colors and the album art
- Screenshots from a headless browser
It's cool. Check out the results:
Top number: 15
Search track: Weird Fishes
Top number: 4
Search track: Is She Weird Pixies
pyppeteer
spotipy
io
os
asyncio
json
requests
sklearn
numpy
pillow
matplotlib
pyppeteer
(Python Puppeteer port) requires a chrommium browser to be installed.- Perform setup of a Spotify application to access the API. See Spotify for Developers.
- Update
spotify_credentials.json
with your own credentials.
- You can change the number of dominant colors and gradient structure by editing
n_colors
and the css file inassets
respectively. - You can edit the HTML file freely
- This project is very personal and it might not be suited as a general purpose tool as of now.
- Better CLI (it sucks right now ☠)
- Non-hardcoded gradient
- Better color preprocessing
- Better way of generating the image from the HTML