Painting Like Monet

Claude Monet (1840-1926) was a French impressionist painter known for the “dab, dab, dab” style of his paintings. I can imagine him at work, peering at a spot on his subject, mixing an appropriate color of paint, then dabbing the corresponding spot on his canvas.

Let’s take a look at a Plain English program that does essentially the same thing as ol’ Monsieur Monet. We begin with some type definitions:

A subject is a string.
A model is a picture.
A painting is a picture.
A frame is a box.

And that leads us to the general outline of the program as a whole:

To run:
Start up.
Put “Purple Grapes” into a subject.
Find a model of the subject on Google.
Paint a painting using the model.
Reveal the painting with the subject as the title.
Wait for the escape key.
Shut down.

The critical routine is the one that does the actual painting. This is it:

To paint a painting using a model:
Resize the model to 4 inches by 4 inches.
Center the model in the screen’s box.
Move the model left 3 inches.
Draw the canvas.
Draw the model.
Pick a spot anywhere near the model’s box.
Mix a color given the spot.
Move the spot right 6 inches.
Dab the color on the spot.
If a counter is past 30000, break.
Make a frame 4 inches by 4 inches.
Center the frame in the screen’s box.
Move the frame right 3 inches.
Outdent the frame 1/4 inch.
Draw the frame with the black color and the clear color.
Refresh the screen.
Extract the painting given the frame.

It begins by setting up the model a little left of center on the screen. Then it loops around, painting. Like Monsieur Monet, it picks spot on (or near) the model, mixes up an appropriate color, and dabs it on the corresponding spot on the canvas on right side of the screen.

This is the routine that does the actual dabbing:

To dab a color on a spot:
Pick an ellipse’s left-top within 3/32 inch of the spot.
Pick the ellipse’s right-bottom within 3/32 inch of the spot.
Draw the ellipse with the color and the color.

This is a screenshot of our Purple Grapes model (left) and painting (right) after about 2,000 such dabs:

Colors are matched exactly, unless they are very very light, in which case a color that will better match the background canvas is chosen. This is the routine that does the mixing:

To mix a color given a spot:
Get the color given the spot.
If the color is not very very light, exit.
Pick the color between the lightest gray color and the white color.

And here is a screenshot of the finished work, after 30,000 dabs, with a frame and a title:

Since we fetch our models from Google, the program is capable of painting almost any imaginable subject. (We don’t have to worry about usage issues, by the way, because this kind of transformative art falls under the “Fair Use” section of the Copyright Act of 1976, 17 U.S.C. § 107.) Here, for example, is a painting of a forest path:

And here is a painting of one of a geek’s most indispensable accessories:

Dab, dab, dab.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s