How to convert Stroke masks to transparency in Adobe Illustrator

Print Friendly, PDF & Email

Make no mistake that I am not fond of my office’s current logo. However, I’m setting that fact aside for the purposes of this post. And permit me to warn you, the reader, that the content of this post is aimed at those with a reasonable working knowledge of Adobe Illustrator. This isn’t quite beginner material.

Also please note that if you are reading the Facebook Note version of this post, it may not be formatted properly with paragraphs and image placement. You can head to to read it properly, if necessary.

Since I am required to utilize the logo, I have struggled on numerous occasions to work around an issue left by its designer. One part of the logo—a somewhat complex shape—has a rather thick stroke (outline) that is in place to create a gap all the way around it. Behind this shape is a series of horizontal lines. All the lines appear to be cut just short of where they would “touch” the complex shape on the top layer. The white stroke is actually covering the horizontal lines, but since white generally doesn’t print (it is assumed to be the paper color), the lines appear to be cut off.

This would be fine if the logo was only used on top of white. Indeed, when it was designed, administrators had only given thought to printing it on white paper as stationery (alas, my department wasn’t consulted about the logo as it should have been until just about the day it had long been finalized and was to be printed). Yes, I can make the stroke a different color if I place the logo on top of a solid-color shape, but that workaround is out the window if the background is multiple colors.

Adobe Illustrator has a function to select two shapes—one on top of another—and perform a punch so that you are left with the topmost object gone, and the topmost object’s shape punched out of the bottom object. However, this only works for the filled-in portion of an object. Strokes (outlines) are ignored.

After more than a decade of battling this quirk, I’ve at last discovered the solution. Before demonstrating with my office’s logo, I’ll share the technique with a much simpler shape. Please note that all the images in this post are scaled down. You can click any of them to enlarge the detail.

Start with two basic shapes

So I’m starting with two very simple shapes. The blue star overlaps the red rectangle. But I want a gap around the star so that the background shows through between the star and the rectangle. It’s an easy fix—just apply a white stroke around the star at whatever thickness is desired.

White stroke applied

Voila. The task seems to be complete. But we still have a long way to go.

Let me point out here that Illustrator does have a setting when applying a stroke to choose whether 1) the center of the stroke follows the edge of the object’s fill (meaning half the stroke overlaps the edge of the object and the other half is beyond the original filled area), 2) the entire stroke is just inside of the fill’s edge, or 3) the entire stroke is just outside of the fill’s edge.

Normally, I’d probably want to use the third option. The first two will always make the filled portion of the object appear a bit smaller because the stroke is either partially or completely overlapping the outer edge of the object. For this example, however, I’m going to leave the stroke set to the center stroke option for two reasons. First, since the first option is the default way a stroke is applied, I’m not going to assume that a designer has changed it to follow the outer edge. Second, there may be some instances where overlapping the stroke was intentional.

So, while simply adding a white stroke works perfectly fine for flat, two-dimensional shapes on a white background, what happens if the background isn’t white?

Mismatched strokes and backgrounds

Suddenly my gap shows up as the stroke it really is instead of as a way of keeping the star from directly touching the rectangle. Okay, I can fix this. I’ll just change the stroke to the same color as the background.

Stroke color matching the background

There! I fixed it! (With apologies to Or did I? I just got a call from the client who says to try things like a bevel or a drop shadow on the rectangle.

Drop shadow fail

Whups, that doesn’t look right. But maybe it’s okay. The client called again to say forget about the shadow, but there’s this pattern that should be in the background.

Pattern background fail

Although that’s not as bad as when the shadow was applied, the stroke is still visible.

As I explained in the opening of this post, Illustrator does have a function which could be the solution. It’s called “Minus Front,” and its function is simple. When two objects are selected and the Minus Front function is applied, the object on top disappears and that object’s shape is punched out of the object beneath.

The problem with this function, as I’ve said, is that it only works with an object’s filled area, completely ignoring the stroke. This is the crux of why I’ve struggled with my office’s logo for so many years—not knowing a way to punch out a stroke.

Turns out, I was backwards in how I was trying to solve this problem. Instead of the stroke punching out an object, which cannot be done, the solution is convert the stroke into a filled object which can punch out another object.

Yes, it’s that simple, and it took me 10+ years to realize it.

So here’s the procedure. First, I’ll select the blue star which has a green stroke around it (although the color of the stroke makes no difference). Then, I’m just a single command away from converting this object with a stroke into two objects: the original filled object plus a second object matching what the original object’s stroke looked like. The command I’m looking for is under the Object menu, Path, Outline Stroke.

Converting a stroke into an object

If you click to enlarge the above image, you can make out a blue line just beyond the blue star which follows right in the middle of the green stroke outline. This blue line represents the actual boundary edge of the star’s fill. Remember when I described how a stroke can either follow the center, inside, or outside of an object’s boundary? The above image shows how half of the stroke set to center mode overlaps the star and the other half extends outside the star’s edge.

These two objects—the blue-filled star and the green outline—will be grouped together after the Outline Stroke command and will need to be ungrouped. With the grouped items selected, I head to the Object menu and choose Ungroup.

Since the stroke that was around the star is now an independent object that is filled and contains no stroke, I could simply use it now to punch a shape out of the rectangle. But not so fast. Remember earlier that I said I was leaving the default setting of a center stroke that partially overlapped the star as well as the rectangle. I’m going to need to punch the stroke’s shape out of both objects, so I’ll select only the new object that was converted from the star’s stroke, copy it, then in the Edit menu, I’ll select Paste in Back which will make a copy in the exact same location as the original, but send it behind the original so it’ll be waiting for me when I’m ready for it.

Supposing the stroke shape needs to be punched out of three or four objects, the task is simple. I just copy and Paste in Back two or three more times so I have a copy of the stroke object for each additional object I wish to punch. Much more than three or four, however, and there’s a shortcut that I’ll describe later.

Just to make sure I know which objects I’m working with, I click off of the pasteboard to deselect all objects, then carefully click to select only the new stroke object that the Outline Stroke command created. Then, I will shift-select the blue star so that both objects are selected.

In the Pathfinder palette (accessible in the View menu if it’s not already available), the second Shape Mode button is what I need next: Minus Front.

The Minus Front function

Voila, the star now has been reduced in size a little bit where the stroke object had been overlapping. Now, I simply repeat for the rectangle: select the copy of the stroke object I made earlier, use the Bring to Front command, found in the Object, Arrange menu, to make sure it is above the rectangle (although it should already be), shift-click the rectangle to select it as well, then use the same Minus Front function.

The finished stroke knockout

And there it is. The background pattern shows through the gap, and if I click to select the red rectangle, I can see the control points which prove the object really was cut out by the stroke object.

Control points on the red rectangle

Not only will this work for either a multi-color background or using a drop shadow, but I can even do both.

Patterned background AND drop shadow

There is one small caveat. If I move the blue star away, I see that some possibly unwanted portions of the red rectangle are still present.

Leftover fill area

What has happened here is that only the stroke object punched through. There’s a simple fix, though. Just click to select the undesired leftover fill area on the right edge of the rectangle, and delete it. Note that it may be difficult putting the star back in the exact same place. I moved it by using a counted number of arrow/cursor key nudges, but it doesn’t have to be moved at all. Alternatively, I could have selected that leftover object by using the Select menu, Next Object Below command.

Well that takes care of the problem for a very simple design, but in the case of my office’s logo, it was considerably more tricky. Here’s a look at part of the logo, placed on top of a black background instead of white to show the stroke mask.

Complex logo on top of black background

The procedure was much more difficult for this logo for several reasons.

1) The white stroke actually is not part of the visible brown palm graphic. Instead, the designer duplicated the palm directly beneath and applied the stroke to the copy. My only explanation is that he wanted the appearance the center stroke mode as opposed to an outer stroke, but avoid having stroke partially cutting into the fill area of the palms as it did with my blue star example.

2) The palms were made up of numerous objects all with the thick white stroke applied, but this was probably the easiest part to fix—I simply selected all the stroked objects that made up the palms and used the Unite function in the Pathfinder palette to make them a single object.

3) The horizontal lines, representing a sunrise, were individual stroked lines with no fill. Just as much as strokes cannot be used to punch a shape out of an object beneath, a stroke itself also cannot be the recipient of such a punch. Double whammy. Actually, it was a triple whammy because, as depicted in the image above, the lines are all inside of a circular mask. This can be seen when I switch to Outline view mode.

Outline view mode

4) Complicating matters even further was an an additional layer of stroked objects on top of both the palms and the horizontal lines. This additional layer is the words for the name of where I work which I have chosen to remove and not mention for the purposes of this tutorial. Suffice to say after punching the stroke around the palms out of the horizontal lines, I then had to repeat the process to punch the stroke around the words out of both the palms and the horizontal lines.

Someone would probably tell me I could have worked with the horizontal lines as is, but I chose to temporarily remove them from the clipping mask to make sure I didn’t introduce any unforeseen problems. Easy to do: select any one of the lines, right click (or Control click if you use a Mac with a single-button mouse), and choose Release Clipping Mask.

Releasing a clipping mask

It is important to know that the object used to mask the horizontal lines into a circle is still there. It just isn’t generally visible because it contains no fill and no stroke. But if I hover the mouse pointer over its boundary, it is temporarily highlighted.

Temporarily highlighting a no-stroke/no-fill object

Because working with the commands to select objects that are beneath other objects is cumbersome to me, I’m going to move the brown palms out of the way. To make sure they get back exactly where they came from, I held down the Shift key and pressed the right arrow key 10 times to nudge the object off to the side a precise amount. (The shift key multiples the nudge amount by an amount defined in preferences.)

Nudging an object out of the way

Notice how the horizontal lines touch the palm object when there’s no white stroke to mask them? Just as before with the blue star, it’s time to convert the white stroke into a filled object.

Converting the palm object stroke into an object

Same procedure as before: Object menu, Path, Outline Stroke. Then I can do the same command on the horizontal lines to change them into filled objects which can be punched. In this case, they were grouped together so I only needed to select one of them and repeat the Outline Stroke command.

Converting the horizontal lines into filled objects

The next step took me a little while to figure out. You may remember above where I described how to make multiple copies of the stroke object to punch more than one other object. Rather than do that more than a dozen times for this logo, I wanted to punch them all at once. The fact they are all the same color made things a little easier. If not, I’d have had to temporarily make them all the same color, then change them back afterward. After a bit of trial and error, I discovered that all the horizontal lines needed to become a compound path.

Turning multiple=

There’s the secret. From the Object menu, I selected Compound Path, Make which causes Illustrator to treat all the objects as a single object.

The next step is to punch the palm’s stroke mask out of the lines. Just as before, I select the stroke object that was formerly the white palm outline, then select the horizontal lines with a single shift-click of any line, then head back to the Pathfinder palette to use the Minus Front function.

Successful palm stroke knockout

Now, all that remains is to put everything back where I found it. After nudging the palms back in place with the shift-left arrow key, I mouse around to find the circular mask, click to select it, shift-click one of the horizontal lines to select them as well, head back to the Object menu, highlight Clipping Mask and choose Make.

Restoring the clipping mask

And with a final VOILA, I am finished. Okay, excuse the pathetic background, but it will suffice. Here’s the logo, sans white stroke mask, with a gradient background showing through the gap.

The completed de-stroked logo

I hope you were able to follow me. It was something of a challenge within the space of this blog post to explain what I’d been wishing to do for more than 10 years and ultimately fiddling around with actually doing it for the better part of a day.

I still miss Freehand’s simplicity and always will, but I am finally beginning to gain a better appreciation of Illustrator’s capabilities, especially since I’m not sure this stroke-to-object procedure was possible at all in Freehand.

5 Responses

  1. Jenny says:

    Can this be done with fonts?

    • Lee Bennett says:

      The thing about fonts is, first of all, when they are still editable text, fonts don’t have strokes. Fonts are designed only with fills. However, in editable text form, I don’t believe Illustrator avails the path commands such as punching an object beneath. To do path operations, you have to convert the fonts to outline paths. At that point, even though it still looks like a font, it’s actually no different than any other drawn art. But even after converting to paths, there still aren’t any strokes. So the core answer to your question is probably no, or perhaps more accurately, it doesn’t apply because there were never any strokes to begin with. That being said, if you converted a font to paths and added a stroke to those paths, then yes, my instructions here would apply just the same because, at that point, you’re working with art and not fonts any more.

  2. Kurki says:

    Thanks for this!

    I had gotten to this point on my own yesterday – outline strokes to convert them to shapes, but am struggling with an issue.

    In my case, I’m trying to make gestural/sketch strokes cut out of a silhouette shape. Like your logo I need to put it over any color background. But I’m finding upon doing the minus front command those “strokes” are much lighter in weight. I’m thinking it has something to do with the stroke vs. path placement? But when applying the initial strokes to the paths I drew, my inside/outside/center buttons are grayed out. Is that because they are a path and not a shape?

    Any thoughts on why I’m seeing my “gap” reduced upon performing the minus front and how I might fix it?

  3. Lee Bennett says:

    First of all, remember that every shape has a path. That’s just how Illustrator works. Thus, the only reason I can think of (and bear in mind I’m *not* an Illy expert) that would cause the in/out/ctr buttons to be grayed out is that your path has no stroke applied.

    As for the size looking thinner after performing a Minus Front command, I think that might just be an artifact of low screen resolution. I’ve seen that phenomenon before as well. Illy might show strokes a little fatter than they really are when you’re zoomed back a ways. Try zooming very close to a section of the stroke and then performing the Minus Front command again and see whether or not it truly gets thinner.

  4. Mark says:

    Lee, I had EXACTLY the same problem. Some external “designer” did not think about the graphic being used on non-white backgrounds, and so there where some objects with big white strokes. Put on a gray background, it looked just dead ugly. Argh! Soooo – thank you, thank you, thank you very much for this great and easy-to-understand article! :-)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.