Graphic Design

Extracting Flawless Forms

young man on a boogy board at the beachExtracting forms from photographs can be a daunting task if you’re not familiar with the full potential of Adobe Photoshop. The first time I tried to do it, I used the selection tools, which was really scary, because I didn’t know an effective way to correct any errors that I made (there are actually plenty of ways to correct these types of mistakes, but I can be pretty slow to catch on sometimes). Soon afterwards, I became familiar with the magnetic lasso selection tool, which tries to find the edge of your form for you. This is usually a bad idea, as I soon discovered. It produces mediocre results at best, and is a tragic waste of time, most of the time.

Some forms can take a long time to pull out, perhaps even hours. Doing this with the selection tools can seem almost unreasonable, even with undo and history, because you spend so much time creating one selection shape. If you mess up that shape, you can’t undo just the part you messed up on; the whole shape counts as one move, so you either undo the whole thing or move on.

There are several ways around these initially confusing dilemmas, but I’m going to skip that for now and move on to a much more effective way of extracting forms: Shape Layers. Shape layers are a much better tool to use when extracting forms, for the single reason that they make use of the pen tools and vector shapes. The pen tools are far better than the selection tools when extracting forms for several reasons:

  1. Selection tools are not as flexible. You can’t change the shape of a selection. I will grant that you can add to, subtract from, or find intersections with selections, and this will, in essence, change their shape. With the pen tool, however, you can do everything that you can do with a selection, plus you can alter the actual shape after you’ve made it, at any time, with tremendous ease.
  2. Pen tools create vector shapes. Vector shapes are permanent. They don’t disappear after you’re done with them unless you deliberately throw them away. You can use and reuse them, alter and re-alter them.
  3. Vector shapes can, and will, be used as the building blocks of selection shapes. This means that if you decide that you want a selection later (and you will), you can always produce one using your vector shapes. The reverse, on the other hand, is not true; you can’t create a vector shape from a selection.
  4. Vector shapes can be developed incrementally. With selections, you can’t just walk away until you’re done drawing your shape. If you save your work and close your document while you’re in the middle of drawing a selection, when you open that document back up, the selection will not be there. Vector shapes can be put down at any point, and easily picked back up later, even if you save and close the file.
  5. The pen tools can use tangents to quickly and easily create curves. This may well be the greatest advantage of all to using pen tools. If you want to create a clean curve with the selection tools, you better have some of the best freehand skills around, because it’s going to be all manual. Alternatively, you can use a pen tool, which will instantly and almost effortlessly create clean curves to suit your every need.

I need to state here that almost all of the tasks mentioned in the above list can, in some form or another, be done with selections; however, it will generally be far more difficult, awkward, and time-consuming, and you may even have to use a shape layer to do it right. By the time you’re done with all the acrobatics it will take to get the job done with selections, you could have just spent a very short amount of time learning the pen tools, and then made up for that very quickly with the countless hours you would save doing it the easy way and enjoying all of the subsequent advantages.

So let’s get started, shall we?

Select the pen tool.Select the pen tool in the tools palette. Make sure that you’ve selected the standard pen tool; there are multiple variations of the pen tool that will fly out from that button if you hold it down, all of which serve great purposes, but you should begin with the standard pen. You should be able to tell, because most of the tools look like a pen, but all of them except the standard pen tool have a very small symbol by the pen to indicate a variation in its usage.

Check the options palette.In the Options Palette, which is usually located at the top of your interface, take note of the three modes that are available for vector tools to work in. Use the “Shape Layers” mode, which should be the first option. You can tell by letting your mouse float over the icons until a tool tip appears, which will tell you the name of the tool. The other mode that can be selected while using the pen is “Paths”, which is not necessary for this exercise. Even if you decided that you need to create a path, be aware that in “Shape Layers” mode, each shape that you create is, in fact, a path. The only difference is that the path is also stored in a vector layer in the layers stack, which makes it easier for you to use and modify.

Begin creating your vector shape.Once you have ensured that all of the settings are correct as described above, you can begin creating your vector shape. This is as simple as clicking anywhere on your photograph, though you would obviously want to begin on the edge of the form you are going to extract. Each time you click on your photograph, a line will be created between your last clicked position and your current one; this is the beginnings of the vector shape. You will notice that each place that you click has a tiny square that the lines connect to. I’m not sure what Adobe calls these, and I’m too lazy to look it up right now, but for the sake of this article, we will call them vertices (plural) or a vertex (singular). I may also refer to them simply as points. Some of these vertices may also have one or two antenna-like stems protruding from them, besides the lines of the vector shape. Again, for the sake of this article, we will call these curve control handles, because they control the way that the lines of the vector shape curve. I may refer to the curves as tangents, and I may refer to the way that the lines curve, or the degree or intensity of their curve, as tangency.

Observe the color of your vector shape.Once you have laid down several vertices, your vector shape will begin to take on some degree of volume, meaning that you will begin to see the color in the center of the shape. At this point you will probably want to make some adjustments to the way that the shape is displayed.

Adjust the opacity of the vector layer.First, you don’t want the shape to be completely opaque, because it will begin to cover the form in the photo that you are trying to extract from, which will quickly begin to hinder your ability to see the appropriate edges clearly and make good decisions about point placement. I typically pull the shapes opacity (or transparency, as Photoshop calls it, which is technically a misnomer) down to around 25%. This gives me just enough opacity to see the area of coverage as I move along, and it gives me plenty of transparency to see the form behind it.

Adjust the color of the vector layer.Pick a color.The second adjustment you may want to make is the color of the shape. You can change the color of your layer by double clicking the layer’s preview icon on the left side of the layer in the layers palette (The icon will be a solid color, which will match the current color of your vector shape). This decision is rather subjective, and should be made based upon the predominant colors of your photograph, as well as what personally suits you. If your photo is dark, I suggest changing your shape to a lighter color, and vice versa. There’s also a possibility that your shapes initial color works quite well without any change. The goal here is to increase the visibility of your shape, without increasing its opacity, to aid in the decision making process as we move along.

I’d also like to note that you may want to make your shape completely transparent. You’ll still be able to see the outline of your vector shape clearly as you work with it. Sometimes I choose this option, and it seems to depend solely upon my mood at the moment. If you do choose to do this, then the color of the shape is obviously irrelevant.

Now that we have gotten many of the preliminary considerations out of the way, you may want to start all over. I needed you to get this far so I could discuss the optimal way to configure your shapes appearance. However, we haven’t discussed how to adjust the curvature of your lines as you work, so there’s a good chance that your shape looks a bit questionable right now. No worries; you haven’t done that much work yet. You can safely throw it away and begin again, keeping in mind the display settings that we just discussed.

Click the layer mask preview icon.Look for the symbol by the pen tool.If instead you decide to continue where you left off, look to see if the line is still visible, and if you can still see the vertices of your vector shape. If so, you can just continue with the pen tool as if you had never stopped. If you can’t see the both the line and the vertices, you can still continue your shape. Just select the layer in the layers palette that your shape is on, click the layer mask preview icon on that layer (the large box to the right of the layer’s preview icon; it’s probably a gray color). This should cause the line on your layer to reappear; if not, click the preview box one more time, and the line should appear. Now select the pen tool and float it over the end of the line until a tiny box symbol (like a vertex) appears by your pen. This symbol tells you that your pen is in the continuation mode; you can click your mouse on the end of the vector line, and you should be starting right from where you left off.

Before you begin creating your shape (or continue, as the case may be), there are a few considerations to make that might save you a significant amount of time. Always remember that you don’t need to be a perfectionist unless you have to. More shortcuts mean less time; less time means more profit. And there’s nothing wrong with taking a shortcut as long as it doesn’t effect the quality of the final design. Ask yourselves these questions:

  1. What type of background is the final form going to be against? What type of background is the form against in the original photograph? Are the backgrounds similar? Are they both dark, or both light? Are they both noisy? If the backgrounds are similar enough, you can relax a bit; if the edges of your final form aren’t perfect, chances are you won’t be able to tell. On the other hand, if the backgrounds are really different, you’ll need to be more careful. This is a decision that will get easier with practice, and it will save you lots of time in the long run.
  2. How big will the final image be? How big is it now? If you’re extracting a form from a high resolution photograph, and then shrinking it down drastically, i.e. For a web page, you can relax a bit, because any minor mistakes that you make will probably be shrunk down to virtual nonexistence. If you’re not shrinking the final form down much, or not at all, you’ll definitely need to be more careful.

Both of these considerations can be made with a moderate grain of salt, because when you’ve completed your vector shape and extracted your form, if you find that some flawed edges are visible, or that some mistakes were not lost in the final resize, you can always go back and make adjustments easily, without any really significant loss of time, as you will discover later in this article.

Keep lines between the anti-alias edge.When you begin to draw your shape, you should zoom into your photograph to at least a 400% view. I generally operate at 800%, or even 1600%, which is as far as you can go. Zooming in helps you to see what I call the anti-alias edge. This edge is the area where your form subtly blends with the shapes and colors around it. If you view your photo at 100% or less, the edge of your form probably looks sharp and well-defined (if it doesn’t, this exercise won’t work very well). As you zoom in, that edge will begin to lose some definition, and the more you zoom in the fuzzier the distinction gets between your form and its surroundings. This fuzziness is called anti-aliasing in the technology sect, and it is the very thing that makes your edge look sharp and smooth when you view your photo at its actual size. If there were no fuzziness, the pixelation of your computer monitor would cause your edge to look jagged and rough.

It’s important to understand this edge, because when you extract your final form, Photoshop is going to create its own anti-aliasing to make the edges of your shape crisp, smooth, and easily blendable with a new background. This means that in order to achieve the most realistic final effect, you need to try to keep your lines directly in the middle of the fuzziness, so that the final anti-aliasing matches the original anti-aliasing as closely as possible.

Click and hold the mouse.  Don't release.Now drag the mouse to create a curve in your line.As you click the left mouse button to lay down a new control vertex, try holding the mouse button down and dragging the mouse a bit. You’ll notice two control handles growing from the control vertex. If you continue with your shape by creating another vertex, you’ll also notice that the two lines that go to and from the previous vertex with the control handles, these two lines connect to your previous vertex very smoothly, as if they were one line. If you didn’t hold and drag your mouse, these two lines would connect very sharply, forming a well-defined corner. The property that determines whether this connection is smooth and curved, or sharp and defined, is called *tangency*. If the connection is smooth and curved, the tangency is said to be continuous, and if it is sharp and defined, like a corner, the tangency is said to be broken.

Alt-click and drag control handle.Alt-click and drag control handle.The workflow for controlling this property is very intuitive and seamless as you are creating your shape; it doesn’t even require that you change your tool. At any time, you can go back to any vertex in your shape and alter the appearance of the connection there by clicking it with the Alt key held down, either by alt-clicking a vertex at a smooth connection and letting go quickly, which will break the tangency. You’ll notice when you do this, that your pen is actually controlling one of the control handles, which you can move around to control the way that the curve looks. You’ll also notice that the the other handle on the same vertex (there will always be either two or none), will remain on the opposite side of the vertex, no matter where you move the handle you’re holding. This is another sign of continuous tangency.

Another way of breaking tangency is to alt-click and drag one of the handles. This will allow you to move the handle you have selected without effecting the other handle. This will give you a sharp corner where the two lines connect, but the two lines that connect there will have a curvature of their own. If a line connects two vertices and neither of those vertices have control handles, that line will have no curvature; it will be perfectly straight.

Alt-click and drag on vertex.Alt-click and drag control handle.Yeah, that was a real snoozer. The bottom line is that you have a tremendous workflow once you get used to it. Alt-click and drag on vertex.Click, hold, and drag to create curves as you go. Click and release to create corners as you go. Alt-click and release a vertex to make curves straighter and turn that vertex into a corner. Alt-click and drag existing vertices to reset and adjust their curviness. Alt-click and drag a handle to break a smooth connection and change the curviness of one side of that connection.

Use this work flow to work your way around your form. Try to stay zoomed in so that the middle of the anti-alias edge is clear to you. Keep your lines in the center of this edge as much as possible. Try to place your points strategically, in the middle of curves and in corners. If you can follow the flow of a section of your form using only two vertices instead of three, this is a good thing. The less vertices you can use to make your shape, the better and cleaner your shape will look when you’re done. Use as many as it takes to be reasonably accurate, and no more.

Once you have completed your form, make sure that you click the first point you made in the shape, to finish and close the vector object.

Watch out for holes.The next thing to do is zoom out and look for holes. Holes in forms can be very elusive and hard to see in photographs, so look very closely. If you find a hole, use the same techniques and create a new shape to duplicate the form of that hole. This will create a new layer in your layer stack. Do this for all the holes that you find. Once your done, you could combine all the shapes into one layer, and bring these shapes together into a composite form with actual holes, but this is not easy unless you have a bit of experience with the tools. For this lesson, we’ll discuss working with the layers separately, which produces a final product that is just as great.

Ctrl-click the layer's preview icon.Ctrl-click the layer's preview icon.In the layers palette, find the layer that represents your primary vector shape. While holding down the control key, left-click the preview icon in the layer. This will create a selection area that is exactly the same shape as your vector object.

Ctrl-Alt-click the preview icon for the holes.Ctrl-Alt-click the preview icon for the holesSo what about the holes? Always keep this rule in mind: for every command, operation, or tool in Photoshop, there are often alternate and similar commands, operations, or tools that can be reached by holding down the Alt, Ctrl, or Shift key, or any combination of the three, while performing the command or operation, or while using the tool (or the Opt, Cmd, or Shift key, for Macintosh users). In this particular case, you can hold down the Alt key, in addition to the Ctrl key that you held down a moment earlier, and then click the preview icon on the layer that represents a hole in your final form. This operation will subtract the shape of your hole from the primary selection area that you just created. You can do this with all of your hole shapes if you have more than one.

Select the photograph layer and press Ctrl+J.You should now have a selection area that looks exactly like your final form, holes and all. In your layers palette, select the layer that represents your original photograph. Once you have it selected, simply press Control+J. This is the hot key command for “copy to new layer”, which will extract your final form from the photograph. Turn off the visibility of all the layers except the final form.Click the visibility toggles on your photograph and on the background layer, as well as all the vector layers (the visibility toggle is the eye to the far left of each layer in the layer palette; if you only see a small empty box there, that should mean that the layer’s visibility is turned off, which is what we want). The only layer that should be visible is your final form.

The final form.What do you think? Pretty sweet, huh? You can now copy, drag, or place this shape into any other Photoshop document and on top of any other background or layer, with some very pleasing results. Try applying a drop shadow layer style, which will create some nice depth to your layer. This could be a good or bad thing, depending on what your final form is, and what level of realism you’re trying to achieve in the long run.

That’s the best workflow I know of to extract forms from photographs. The truly great part about using vector shapes are their flexibility and non-destructive nature. For example, once you’ve extracted your form, if you’re not happy with the results, you can just delete your final form, turn the visibility of your original photograph layer and your vector layers back on, go back to your vector shapes and make adjustments to the shape using the point adjustment tools, i.e. the white arrow, and the tools that are under the same button with the white arrow, which you can use to manipulate the existing vertices and control handles. You can also use the pen tools to add and subtract vertices, or you can select a vertex with the white arrow, and press the delete key, which will will open your shape back up, at which point you can select your pen tool, click the end of the open line, and add a new series of vertices to your shape. This is a very, very flexible methodology that will never leave you in a corner with no options.


No comments for “Extracting Flawless Forms”

Post a comment