Can a Computer Paint a Picture? Using Genetic Programming to Create Art
Stephana (Hayoung) Lim ’21 never expected to be doing anything related to art in college.
When she first came to Hamilton, she intended to major in physics, but soon switched over to computer science after taking a class with Visiting Assistant Professor of Computer Science David Perkins.
Now, under the guidance of Perkins, Lim—along with her partner Donald Holley ’20—is combining her passion for computer science with artwork and watercolor paint.
Major: Computer Science
Hometown: Malvern, Pa.
High School: Episcopal Academy
In their project, “Machine Learning and Art,” Lim and Holley are experimenting with genetic programming to create a computer-generated painting.
Using a computer program, they assigned several digital canvases “genes” based on qualities like brush velocity and edge detection. Then, they programmed the canvases to use 1500 strokes to paint a picture based off one target image.
When the painting is in its early stages, it looks like nothing more than a shapeless mass of brushstrokes. Slowly, images start to emerge from the colors—a form taking shape out of the messy strokes until it starts to resemble the target image.
The completed paintings are then scored through an algorithm. With these scores, the program selects two of the top performing paintings as parents, mixes their genes up randomly, and then creates new canvases to start the process all over again.
“It’s basically genetic engineering,” said Holley. “We’re using natural selection in a computer program to select the genes that paint the most accurate picture. Then those genes essentially breed to create even better offspring. This goes on until hopefully we have a set of genes in a program that produces a high quality painting.
Major: Computer Science
Hometown: Canandaigua, N.Y.
High School: Canandaigua Academy
Lim was eager to use her interest in computer science for an art related task. “I love that this project involves art because it makes me feel like I’m really creating something,” she said. “That’s what drew me to physics at first, actually, because of the mechanics of it. But I think I realized that computer science is kind of an art in itself. I can see every step of the process unfold and take part in creating something beautiful.”
After graduation, Holley hopes to use his computer science experience to enter the world of software development. “This project was great practice,” he said. “The industry is relying more and more on creativity. A lot of software projects now are incorporating art, so we’re really creating something that contributes to the future of the computer science field.”