Personally Themed Generative Art

k-means clustering Color Palettes Generative Art Data Art

An explanation of this year’s stocking stuffers


Author

Affiliation

Ryan McShane ORCID ID for Ryan McShane

 

Published

Dec. 24, 2022

DOI


In my last blog post, I demonstrated that one could extract the dominant/most common colors in a .jpeg using k-means clustering to create a color palette, which I skillfully randomized to create thematic art.

Here, I’ll show the source images and the resulting art I’ve made.

Batman Lunchbox

Source Image

A compilation I made:

The initial color palette (with k=30 clusters):

The curated color palette with modified weights and removed colors:

Final Print

World Map

Source Image

The initial color palette (with k=30 clusters):

The curated color palette:

Final Print

Andy Sports Fandom

Source Image

The initial color palette (with k=30 clusters):

The curated color palette with modified weights and removed colors:

Final Print

Armenian Color Palette

Source Images

The initial color palette (with k=50 clusters):

The curated color palette:

Final Print

White Mountains

Source Image

Left: the original image taken in New Hampshire in Fall 2021. Right: an edited version of the image removing many of the brown tones – my goal was to provide the color spirit of the experience.

The initial color palette (with k=50 clusters):

The curated color palette (regrettably, a nice orange did not appear in the k=50 clustering, although it did appear in the k=100 clustering I tried. I should have used bind_rows in retrospect):

The Final Print

Futurama

Source Image

The initial color palette (with k=50 clusters):

The curated color palette:

And we can even see who/what each of these colors belong to (below). The skin tones end up making the art look weird, so I removed them as well.

The Final Print

Bob’s Burgers

Source Images

The initial color palette (with k=50 clusters):

The curated color palette:

The Final Print

Requested World Flags/Map Posters

Source Image

There are two color palettes below, the first with k=99 and the second with k=149 (both with the border grey color removed). We can compare the first 99 clusters (colors) of both palettes and see that the former color palette ends with a few brown shades that are simply the average of the rare colors, while the latter is more vibrant.

Using the k=150 clusters, we can examine a few palettes with the first 110, 120, 130, and 140 colors:

140 (of 150) Color Version at 16” x 20” Output

And the 16”x20” World Map Print, updated: