How To Separate Line Art From Background In Photoshop
In this tutorial we’ll look at the 3 of the most common methods for separating line art from the background as well as a fourth method using the SIMPLETRACE Stipplr Action. There are many reasons to want to separate the line art from the background such as adding a gradient, colouring individual shapes in the line art or adding a layer effect to the line work.
Whatever the reason is, the goal is to work with the line work independently from the background.
- Tutorial Assets
- Method One: Magic Wand
- Method Two: Invert Masking
- Method Three: Blending Options: Blend If…
- Method Four: Stipplr SIMPLETRACE (best method!)
- Vectorized Shape Compared With Source Image
In preparing this tutorial to teach Stipplr users how to separate line art from a sketch, comic book or photo I decided to also cover a few other methods which have nothing to do with Stipplr and are provided simply to make you aware of them.
Separating line art from their backgrounds is nothing new, there are many tutorials around the web for extracting sketched linework from a solid white background.
The source image used in this tutorial is from a Captain America (October 1976) comic book featuring Jack Kirby as the artist. If you would like to follow along with the tutorial then you will need to follow the link provided in the Assets section at the start of this tutorial — remember to download the larger 1,790 pixel by 1,815 pixel scanned frame and not the thumbnail.
Here is the Jack Kirby frame illustration you will be downloading and using for the SIMPLETRACE method later in this tutorial:
I suggest you crop the Kirby frame to a similar dimension used in this tutorial, here is what my cropped version looks like:
The resolution of your source material really matters, Stipplr will produce much better results image tracing larger source images than it will with lower resolution sources.
NOTE: Stipplr is limited to processing 6MP images. For example, images whose dimensions are 3000 x 2000, 2000 x 3000, 2500 x 2500, 5000 x 1000 and so on. Any dimension under 6MP is fine.
Method One: Magic Wand
The magic wand method is probably the most popular way to extract line work as it’s incredibly simple but only works well if the background is a solid colour like white or green. As such, I have prepared a black & white version of the Captain America panel for the purposes of demonstrating the magic wand method (you can follow along using your own artwork).
- Open your line art document
- Select the magic wand tool
- Set the magic wand Tolerance to 1
- Enable the magic wand Anti-Alias checkbox
- Disable the magic wand Contiguous checkbox
- Select the line art layer
With the magic wand settings applied, go ahead and click anywhere in the white portion of the illustration.
Immediately after you click on the white the selection expands to all white areas across the entire canvas — the selection is animated and often referred to as the marching ants.
Press the Delete key on your keyboard.
That’s it, your separation is now done.
Because the background layer in my sample has no content we can see right through the Captain America line art layer to the transparency below — the line art has been successfully separated.
This method is my least favorite as you will always be deleting some amount of the linework. This is because the 1px anti-aliasing setting on the magic wand cannot help but bleed into the line art thus causing a fraction of your linework to be removed when you press the Delete Key.
To clearly visualize how this method erodes your line art, watch the following animation as it cycles through the process of deleting the white space by pressing the Delete Key 10 times. Ideally you would never actually do this but the point here is to show you how this process subtly eats away at the line art, watch how the lines on Captain America’s back, shield and text are affected.
Look closely at the eroding pixel detail within the following animated GIF. With each press of the DEL key the designer makes on their keyboard the image sustains additional aliasing damage.
There are plenty of reasons why using this method is unreliable, aside from the visual demonstration above, the source also has to be nearly pure black & white with no raster noise to work flawlessly.
More About The Magic Wand Method
For a more thorough tutorial on the magic wand method, you can read a great post on how to color inked line art in Photoshop which also demonstrates how to color the results.
Method Two: Invert Masking
The invert masking method is another very simple concept for separating your line art from the background. It works primarily with black & white sketch art with pretty good results, and unlike the magic wand method, does not destroy raster data in the process. This method simply inverts your lineart layer and uses the inverted result as the mask. Simple.
Lets try it.
- Open your line art document.
- Select the line art layer.
- Select the entire canvas via Command + A (Ctrl + A on Windows) on your keyboard or through the Edit Menu.
As shown in the image below, you should see a marquee selection around the entire canvas after performing the steps listed above.
Copy the selection.
With the Captain America raster data copied to the clipboard we’re now going to create our mask:
- Bring the cursor down to the bottom of the Layers panel and click on the Add Layer Mask button.
- The mask is created
At a glance, your canvas should appear unchanged (below).
Nothing has changed on the canvas because there is no data in our mask to define what should be masked out, however there really is a mask there and it’s solid white.
What we want to do is paste the contents of the clipboard into the mask but first we need to force Photoshop to show us the mask on the canvas.
- Hold down the Option Key (Mac) or Alt Key (Windows) and click directly on the layer mask (see image).
The canvas is now solid white, that’s because the mask is solid white. What we are looking at is the mask data itself, in this mode the mask is not applied to our layer, we are looking at and modifying the mask directly.
Editing The Layer Mask Directly
In the Layers panel, notice how the tools at the top of the panel are all disabled, this is a good sign you are successfully editing the mask directly and not the source image for the layer.
Paste the clipboard contents.
The image of Captain America which we copied to the clipboard in STEP 1 now appears in the mask thumbnail as well as on the canvas.
Remember that what we are looking at is the mask data, we’re not looking at the effect the mask will have on our source layer — at a glance it looks like we haven’t done anything yet, but we’re close.
With the mask still selected in the Layers panel and visible on the canvas it’s time to inverse the raster data in order to pull our perfect key.
- Hold down the Command Key (Mac) or Control Key (Windows) and press the letter i on your keyboard to invert the layer (see image).
Our mask is now complete, to view the results we need to exit from the mask.
- To exit the mask view, click on the Layer Thumbnail (see image).
That’s it — a perfect key pulled directly from the inverted raster data of the line art itself.
The advantage of this method is that none of the line art raster data is affected by this process, nothing has been deleted and the integrity of the image remains fully intact.
Alternate Masking Method
Here is a similar method which uses an alpha channel to pull a key rather than a layer mask.
Method Three: Blending Options: Blend If…
This is probably the most overlooked method of separating line art from the background — using Photoshop’s Blending Options which have been around for well over a decade.
- Make sure your line art layer is selected
- Go to the Photoshop menu Layer, and from the Layer Style menu item choose Blending Options… from the submenu.
The Layer Style modal appears and it usually defaults to the Blending Options view. If you don’t see this view for whatever reason simply select Blending Options from the top of the left side column (shown highlighted in the image below).
- In the Blend If section, click on the left half of the slider while holding down the Option Key (Alt Key on Windows).
- Drag left slowly
The slider will split in half and your line art is immediately separated from the background (see image below).
Press OK to close the Layer Styles modal. You are now done.
The line art is now successfully separated from the background and no raster data has been lost from the original source layer. The white pixels are still there, but by dragging the slider in the Blend If section you altered their opacity level and made them transparent.
Further investigation into the Blend If method is out of scope for this tutorial, but I recommend you play with it. While seemingly under-appreciated as a knockout tool, it is probably the most painless way to create knockouts, even from highly complex or scanned white photos.
More About The Blend If Method
If you would like to learn more about the Blend If method, head over to Youtube and search for Demystifying the Blend If Sliders and you’ll be greeted with an abundance of tutorial videos about how this method works such as this Working with Layer Blend If Sliders in Adobe Photoshop video.
Method Four: Stipplr SIMPLETRACE (best method!)
Unlike the methods listed above, the Stipplr method for separating line art from the background is quite different. All Stipplr Actions are designed to extract Adobe shape vector layers from selected raster image layers — and because Stipplr ignores white by default anything which is white in a raster source image becomes fully transparent in the vector shape result.
However, the AUTOTRACE and SIMPLETRACE Stipplr Actions are specifically designed to separate line art from their backgrounds from both scanned B&W artwork as well as scans from 4 color process comic books such as the Captain America sample we are using in this post.
What I didn’t cover in the first 3 alternate methods is that there is always some level of preparation to be done on an image before attempting to separate the line art or convert a photo into Adobe shape vector layers. In STEP 1 below we’ll walk through a very basic touch up process so that the reader understands that Stippr Actions are not magical, they need good content in order to perform well and the reader should expect to do minor touchups.
- Load the Captain America scan into Photoshop.
- Ensure the source image layer is selected.
Once the image is loaded I generally like to zoom in and look around to make sure quality of the image is intact. This allows me to decide if too much noise exists along fine lines that would have to be touched up before running the Stipplr Action.
In the shot above it looks like the back of Captain America’s suit would need to be touched up prior to attempting to trace the image — not so. We are only concerned with noise along sharp or thin edges that define the linework in the image itself. In this case the outline which defines Captain America’s head, shoulders and American flag are more than passable.
However, as we pan over to the text we spot some trouble.
Prior to writing this tutorial I had already processed this comic book scan several times with various Stipplr Actions and in each case found the text to be problematic. The characters are quite thin and the amount of noise within the letters is enough to damage the results we want — to have legible text!
With the dialog rewritten it was then flattened back into the source layer.
Why Are We Flattening?
Stipplr Actions can only trace one layer at a time (multiple selected layers will fail) and it does not work on selected groups.
Our source image is now ready to be separated from the background.
To trace the 4 color process scan we will be using the SIMPLETRACE001 Stipplr Action. This Action will automatically take care of removing the colour prior to tracing the image (adding the colour back to the vector shape result is a different tutorial).
The SIMPLETRACE and AUTOTRACE Actions are very similar, the major difference is that the SIMPLETRACE Actions pause for designer input during the process to allow you to adjust the contrast and tracing tolerance which allows for finer control over the end results.
- Open the SIMPLETRACE001 Details Page
- Hover the mouse over the Solid Black playback button
- Press the playback button
The Stipplr SIMPLETRACE001 Action very quickly applies layer and gallery filter effects to a copy of your source layer and within seconds asks you to set the Threshold Level to your liking.
- Drag the slider left or right until you are happy with the amount of solid black fill
Manually Applying The Threshold Level
The Stipplr Action is effectively paused while the Threshold modal is open. The content you see on the canvas while setting your threshold level is what SIMPLETRACE will be attempting to image trace and save as an Adobe shape vector layer.
Almost immediately after setting the Threshold Level you will be prompted to enter your preferred Tolerance level.
The Tolerance value you enter here informs Photoshop how closely you want the vector paths to adhere to the raster lines. Entering a value less than 1.0, such as 0.5, will cause Stipplr to faithfully trace any aliasing which may exist in your source — this is generally not desirable. A value greater than 1.0 will create increasingly more curvy lines in the final result with fewer vector nodes.
I generally leave this setting to 1.0.
Within seconds the SIMPLETRACE process is complete and your Adobe shape vector trace layer is placed on the layer directly above the source image which was selected to be traced.
Stipplr also cleans up after itself (providing the Action was not halted for any reason) and removes any copies of the source image it was using — Stipplr always generates a single vector shape layer within a containing folder and places it above the layer selected to be traced.
In the image below we can see that the vector shape layer is hard to make out since the result contains a lot of transparency.
In order to clearly see our newly created vector shape and the successful line art separation we need to hide the underlying source layer.
Using the Layers panel, toggle the visibility off for the Captain America source layer.
With the source layer now hidden we can clearly see the separation of the line art from the background.
And here is a zoomed in view to see the quality of the Adobe shape vector path layers.
Depending on your immediate needs, any of the methods listed in this post will help you separate your line art from the background. However, using Stipplr to achieve this result comes with some added benefits:
- Automated workflow walks you through the process saving precious time
- Vector shape result can be scaled and manipulated without pixel destruction
- Convienient removal of colour from 4 color process comic book scans
Vectorized Shape Compared With Source Image
And finally, here is a comparision between our original Captain America 4 color process comic book scan and the resulting Adobe shape vector path layer generated by Stipplr SIMPLETRACE001.
Stipplr Actions are a great way to separate line art from any scanned linework, comic book or photo. All Stipplr Actions are designed to create a vector shape layer which contains an editable graphical representation of the source image as a vector path. Stipplr Actions are fast, reliable, offer a small footprint with regards to your PSD file size and are uncomplicated to work with — results are always contained within a single Smart Object and are not composed of dozens upon dozens of raster layers making it impossible to manage or customize.Download FREE Trial