The Art of the Seamlessly Repeating Pattern

In my two-part article “Creating a Photo-Realistic Line Drawing,” I walked you through a flexible and highly effective technique that enables you to convert a photograph into a black-and-white line drawing, the results of which appear below. (Both Part 1 and Part 2 are available here in dekeStuff.)

Line art samples

I originally wrote this article for the April/May 2006 issue of Photoshop User magazine. In the time since, several readers have sent me examples of the artwork they created using the technique, and I’m happy to report that they look great. But some folks ran into a wall in Step Nine, the one that kicks off Part 2. That’s where I asked you to “establish a couple of repeating diagonal line patterns,” essential in achieving the lithography-style cross-hatch effect, which goes a long way in selling the technique. Although I make the patterns available for download at the end of Part 2, it occurred to me that this one step could use some fleshing out.

After all, a perfectly tessellating tile—in which one side precisely aligns with another to create a seamlessly repeating pattern—has many applications in Photoshop. You can create a subtle pattern overlay, fill a shape with a pattern, paint with the pattern stamp tool, or even heal with a pattern. In this article, I’ll show you a couple of ways to make tessellating tiles. In a separate article, I’ll show you a few fun ways to apply them.

The Basic Offset Pattern

Let’s start by creating the kind of alternating pattern that might appear on wrapping paper. Open an image that contains one or more objects set against a white background, like the cherries (from photographer Matka Wariatka) and text pictured below. The image can be square or rectangular, but it must include a generous amount of white space around the edges. Use Image > Image Size to find the size of the image in pixels. Mine measures 640 by 640 pixels. Small images work best, so downsample if necessary.

Love cherries

Flatten the image (Layer > Flatten Image). Then choose Filter > Other > Offset. Enter half the width of the image into the Horizontal field and half the height into the Vertical field. For me, this meant changing both the Horizontal and Vertical values to 320 pixels. Make sure Undefined Areas is set to Wrap Around and click the OK button. This moves the object into the corners of the tile, as shown below.

Offset filter

To bring back the original collection of objects, choose Edit > Fade and change the Mode setting to Multiply. Then click OK. Photoshop merges offset and original images, as pictured below.

Fade to Multiply

Assuming nothing overlaps (if something does, I recommend you go back to the beginning and fix the problem before proceeding), it’s time to test your tile. Choose Edit > Define Pattern, give the pattern a name, and click OK. Next, create a new image and make it really big, several times as large as the tile. (I made mine twice as tall and three times as wide, or 1920 by 1280 pixels.) Choose Edit > Fill. Set Use to Pattern and select your new pattern from the Custom Pattern pop-up menu. When you click OK, you should see a seamlessly repeating pattern like the one below.

Repeating cherry pattern

The Diagonal Line Pattern

That was simple, eh? Now let’s try something only slightly more complex, the diagonal line pattern featured in the line art technique. Make a new image that measures 48 by 48 pixels. Get the pencil tool and change the brush size to 1 pixels. Press the D key to make sure the foreground color is black. Click with the pencil in the top-left corner of the image window, then Shift-click in the bottom-right corner. The result appears below.

Thick pencil line

It might seem like our line would suffice as a repeating pattern, but alas no. To discover its problems, choose Filter > Other > Offset and change both the Horizontal and Vertical values to 24. Check that the Wrap Around option is on and click OK. A couple of white wedges interrupt the line, as witnessed below.

Offset line

Use the pencil tool to fill in the gaps so you end up with the smooth line pictured below. Leave the black wedges in the top-right and bottom-left corners as is; they ensure that the tile tessellates properly.

Smooth out gaps

Choose Edit > Define Pattern, name the pattern, and click OK. Now make a new image of any size you like, measuring anywhere from a few hundred to a thousand pixels or more. Choose Edit > Fill, select your latest pattern from the Custom Pattern pop-up menu, and click OK. The result isn’t all that impressive by itself (below), but when combined properly with another image, it can be powerful indeed.

Final line pattern

Creating a tessellated tile is child’s play. Employing a seamlessly repeating pattern is (G-rated) adult’s play. You’ll see how and why in my next article.

Next entry:Employing a Seamlessly Repeating Pattern

Previous entry:Creating a Photo-Realistic Line Drawing, Part 2