scala-image

I wanted the ability to manipulate images in Scala with elegant syntax to make it possible to whip up an interesting little visualization or piece of art quickly. It works by creating a wrappers around the Java image and color classes. It also makes it really easy to read and write image files in Scala.

Images generated with scala-image

kmeans1

K-means on pixels, with the distance function mapping to spacial distance

kmeans1

K-means with distance function using color distance

kmeans3

Running K-means as above, but with color labels from https://blog.xkcd.com/2010/05/03/color-survey-results/

random-squares

Squares of the color of the pixel they cover are randomly placed, and the square widths decrease over time.

edge-detection

I run an edge detector on the image, then make the hue map to the direction of the edge. Then I do the same delta trick to spin it.

decision-boundary

A simple program trying to find the optimal split between some data points with brute force.

moving-particles

Some particle floating around. If they get close, a line forms between them and they pull on each other

rainbow-spiral

Each pixel's color is a function of its angle and radius from the center. I add a delta to the angle over time to make it spin.

Built With

Share this project:

Updates