Fluff Lichtenfurr — How to Create Modern Art in Python
After moving into a new apartment, my wife and I wanted to fill the spaces on our empty white walls. You may not know my wife and me, but naturally, we agreed on having more of our dogs on the wall. We had two 12" by 16" sized frames lying around, and my wife proposed we print out pictures of our beloved companions. In our defense, they are incredibly cute.
Even though both of them are incredibly photogenic, I suggested to make this project more interesting and to apply the images with different filters. Also, the photos we picked were taken by an older phone camera, and enlarging the photos too much would make them look pixelated.
At first, I thought which tools would be best suited for this task. I decided I want this task to be simple and that, at the moment, I did not need to use the robust image processing APIs OpenCV and Pillow in this project. For this project, I used scikit-images (skymage) with different Matplotlib colormaps.
If you include the reverse colormaps, Matplotlib has over 130 colormaps to choose from. I limited my options by only testing the Perceptually Uniform Sequential and Sequential colormaps. I created a function that accepts the images I want to hang on the wall, the figure size, and a colormap to test.
I ran this function with my dogs' photos and tested every one of the 32 different colormaps. Do note; I chose to display the images as they get created. To reduce runtime, or if you lack internal memory to hold many figures at once, there are workarounds. Out of those 32, I managed to narrow the options to 3 colormaps that my wife and I agreed looked best.
Seeing the images alongside side one another sparked a different idea. Instead of stretching one image to fit the frame, I could fit the same image with different filters several times, fixing the pixelation problem once we print it.
Even though it’s clear I’m no Andy Warhol, and although this wasn’t the outcome exactly what my wife wanted, I believe I made a step in the right direction. In another attempt to create a magnificent work of art, I created another figure containing the same 4 images. This time, the images are in gray, red, green, and blue colorspaces. Not surprisingly, they are still gorgeous.
I have barely begun scratching the surface in the realm of possibilities. For example, creating my own colormaps or creating filters to change the images even further (e.g., creating my own Roy Lichtenstein style images). Before I feel comfortable printing those, I want to adjust the figure, so each plot is similarly spaced from the other plots. Feel free to leave a comment on the best ways to manually control the figure since I know tight_layout() is working against me in this case.