Skip to content

Tools to arrange album covers by hue, saturation, or brightness into collages

Notifications You must be signed in to change notification settings

frowenz/album-collage-generator

Repository files navigation

Description and Examples

collage

collage   collage   collage   collage  

Click here to see all examples.

This is the product of a MAAD 26210 assignement where we were instructed to create art from data about ourselves. I used my Last.fm data to pull the album covers from every song I have listened to over the past few years and then arranged them based on saturation, hue, and brightness.


How To Use

  1. Make sure you have python installed. Download dependencies by running this command in a terminal window:

    pip3 install pillow requests python-dotenv
    
  2. Download your last.fm data from benjaminbenben.com/lastfm-to-csv. This will generate a CSV file with the following columns:

    Artist, Album, Song, Time Scrobbled 
    
  3. Get Spotify API Keys (see below).

  4. Run the following command to download album covers:

    python3 album_cover_fetch.py YOUR_CSV.CSV NUM_THREADS
    

    Replace YOUR_CSV.CSV with the path to your downloaded CSV file, and NUM_THREADS with the number of worker threads you'd like to use (6 is the default if unspecified). This will download all the album covers into a folder named album_covers.

  5. Once all your images are downloaded, it's a good idea to back them up, as the next script is destructive. Occasionally, there might be duplicate albums covers. This mainly occurs when there exists both a regular and deluxe version of album.

  6. Run the following command to create the collage:

    python3 image_maker.py
    

    Here are the possible arguements that can be passed:

    python3 image_maker.py COMPRESSED_DIMENSIONS SORT_CRITERIA --reverse
    

    If unspecified, COMPRESSED_DIMENSIONS will be 64 meaning each album cover will be cropped to 64 x 64.

    If unspecified, SORT_CRITERIA will be "brightness". The other options are "hue" and "saturation".

    If --reverse is specified, the images will be sorted in descending order.

    By default, the images are arranged in a circular formation. If you want to arrange them from side to side or to double sort them (e.g., sort top to bottom by brightness and then left to right by hue), you will have to poke around in the code. The relevant lines all begin with:

    # Change Me:
    
  7. Your final output will be saved as collage.jpg.

Spotify API Keys

To use album_cover_fetch.py, you'll need to have your own Spotify API keys (client ID and secret key). Follow these steps to obtain your keys and set up the environment variables:

  1. Go to the Spotify Developer Dashboard and log in or create an account if you don't have one.

  2. Click on "Create an App" and fill in the required information to create a new Spotify API application.

  3. After creating the app, you'll find the "Client ID" and "Client Secret" on the application's dashboard.

  4. Create a .env file in the project directory and add your client ID and secret key:

    CLIENT_ID=your_client_id_here
    CLIENT_SECRET=your_client_secret_here
    

    The script will automatically load the client ID and secret key from the .env file.

Future Work

The biggest thing that needs to be fixed is the presence of duplicate duplicate albums covers. This most often occurs when there are deluxe and regular albums or when a single has the same cover as an album.

About

Tools to arrange album covers by hue, saturation, or brightness into collages

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages