Picture Patterns

Make patterns by repeatedly reflecting pictures.

Get a picture of something. Give it the name pic:

Hint: try a common type of animal, or a famous person.

SHOW/HIDE DETAILS

There are lots of ways to get pictures in the Wolfram Language.

On the desktop, you can take a picture with your computers camera using CurrentImage.

You can use the Wolfram Knowledgebase (the same one that powers Wolfram|Alpha) to ask for a picture of something. Hold down the key and press = to get a natural language input field (LinguisticAssistant):

In[1]:=
X
Out[1]=

You can also drag images from most websites and drop them directly into the code.

Give your picture the name pic so you can refer to it later:

In[2]:=
X
Out[2]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Reflect the picture top-to-bottom. Try other reflections, like LeftRight:

Note: run the previous step first to define pic.

SHOW/HIDE DETAILS

Reflect a picture top-to-bottom:

In[1]:=
X
Out[1]=

Reflect the same picture left-to-right:

In[2]:=
X
Out[2]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Join the picture and its reflection:

SHOW/HIDE DETAILS

ImageAssemble assembles grids of images.

This assembles an image from one image repeated in two rows, three copies per row:

In[1]:=
X
Out[1]=

Use ImageAssemble to join an image with its reflection:

In[2]:=
X
Out[2]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Reflect again vertically. Try making other patterns with different combinations of reflections:

Note: reflections other than Left->Right and Top->Bottom will give different-size images that cant be assembled.

SHOW/HIDE DETAILS

Heres the picture joined with its horizontal reflection:

In[1]:=
X
Out[1]=

Add a second row just like the first one:

In[2]:=
X
Out[2]=

Reflect the pictures in the second row top-to-bottom by wrapping them with ImageReflect[,Top->Bottom]:

In[3]:=
X
Out[3]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Repeat two times. Try more times:

Note: it may take a long time to run the code if you repeat more than 4 times.

SHOW/HIDE DETAILS

Well want to repeat the reflect-and-assemble step several times. Thats most easy to do if the code is rewritten as a pure function.

Heres the ImageAssemble expression:

In[1]:=
X
Out[1]=

Heres the same expression rewritten as a pure function applied to the picture. Wherever # occurs in the function, its replaced by pic:

In[2]:=
X
Out[2]=

Apply the reflect-and-assemble function to the picture repeatedly using Nest.

This applies the function f to 0 three times:

In[3]:=
X
Out[3]=

This is a pure function that adds 1 to a number:

In[4]:=
X

Applying the function to 0 gives 1:

In[5]:=
X
Out[5]=

Applying the function three times gives 3:

In[6]:=
X
Out[6]=

Apply the reflect-and-assemble function to the picture two times:

In[7]:=
X
Out[7]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Resize the picture to keep it from getting too large. Try sizes other than 400:

SHOW/HIDE DETAILS

The picture gets larger the more times you nest:

In[1]:=
X
Out[1]=

Reduce the size of the result with ImageResize:

In[2]:=
X
Out[2]=

HIDE DETAILS
In[1]:=
X
Out[1]=

Share ItMake a picture pattern website:

SHOW/HIDE DETAILS

Deploy a website that makes patterns from a picture that you upload:

In[1]:=
X
Out[1]=

Click the link in the output to visit the site.

Share the link by right-clicking it and choosing Copy Address. Paste the link into an email, tweet, or other message.

HIDE DETAILS
In[1]:=
X
Out[1]=