Share

Extracting complex images with Affinity Photo

Introduction:

There are several good tutorials out there, showing how to delete backgrounds or extract subject matters from backgrounds in Affinity Photo. We’re not claiming this being the only method or the best method to accomplish this task, but it has worked great for us. So it may come in handy for you too.

A couple of months ago we got commissioned to edit a photoshoot from which, one of its main tasks, was to extract several female models in dynamic poses with their hair waving in the air. 

We’ll be specially focusing on how to cut-out wavy and curly hair, since it was the kind of hair that gave us the most troubles before we learned from many trial-and-error editing sessions a great way to make it look complex and natural.

The method we gonna show you today, gave us the best results in terms of ACCURACY on the models’ hair details.

 

Spoiler alert: 

We won’t use the Selection Brush Tool

Despite being practically a ‘magic’ tool, Selection Brush Tool, didn’t do the trick this time. It’s always good to try it at first, since it’s quite a powerful tool. But we needed even more precision for this task.

Download:

Since the actual photos of that session are copyrighted, we cannot provide any of those for this tutorial. But it doesn’t matter, these techniques should work on any photo, under any condition.

So, we found this great example on PEXELS. We have cropped it out already and you can download the version we are using here:

Step Uno: Picking and Isolating the Right Channel

Open the Channels Panel from the top menu: View > Studio > Channels. For this tutorial we’ll be using RGB Channels. As you keep learning about Channels, you’ll get familiar with LAB or CMYK Channels, for example.

We can select and isolate any of these channels by clicking on them. They’ll be displayed in greyscale values

General rule says we need to look for a channel that gives us the maximum possible contrast between our background and our subject matter. But also, we can look for the channel that will allow us to get the maximum details, from the subject we want to extract.

In this case, I chose the Blue Channel, because it will hold up hair details better, when applying the first Levels Pass. We’ll get to that in a minute.

We need to be able to edit this Channel directly. To do this, go to the Layers Panel, duplicate our base layer and for the sake of keeping things clear, let’s rename it to ‘Selection’. This layer will act as a stencil to create our mask.

Sounds cool already uh? It is.

Now, with this duplicated Layer still selected, let’s go back to our Channels Panel and Clear the Channels we won’t be using for our mask. In this case Red and Green. Just Right-Click or Command-Click each Channel and select ‘Clear’.

Your Channels structure for the ‘Selection‘ Layer, should look like the image above. That Pencil icon to the right, indicates we’re editing that Channel. It’s important you have that in mind along this tutorial.

Step Dos: Levels Pass

Before using any other tool, we’ll try to turn our background as white as possible applying Levels. There will be some lucky cases when this step will be enough to create our mask. Most of the times, it won’t.

Add a new Levels Adjustment Layer, move the Black Level slider about 20% and the White Level Slider, around 65%. Of course, these values will vary from image to image. 

The goal here is to leave the area around our subject matter as white as possible; and the contours of our subject matter as dark as possible, without losing details.

We need to keep and eye on our model’s hair values. We don’t want a bulky pure-black contour [Fig.B], but a nice balance of values around the edges [Fig.A]. These values will make the hair look more tridimensional and natural when separated from the background.

We’ll take care of that vignetting on the corners in the next step.

Step Tres: Cleaning up using basic tools

Since our Levels pass wasn’t enough to leave our background clean (it’s rarely enough), we’re going to use the Dodge Tool and Brush Tool to remove values we won’t be needing in our stencil.

First, merge down the Levels Adjustment Layer.

Then, we gonna get rid of the vignette around the corners. Use the Dodge Tool and, affecting the Shadows Tonal Range, to help us eliminate that undesired vignette, without losing too much detail on the hair edges.

If the Dodge effect is overexposing your image too much, try lowering the exposure slider to have more control over this brush effect.

I encourage you to try different dodge modes yourself and see which one works better to remove unneeded background details, while protecting our main silhouette.

Tip: Use Dodge Tool in Midtones mode, to remove the excess of grayish tones around the model’s hair without affecting your shadows. Finally, use it in Highlights mode to make sure you don’t have any light grey tones laying around (these can get almost invisible).

You should end up with a pristine white background as shown above. Next, we’ll be using a simple hard-edged brush, to get rid of all the rest of unwanted background details.

Step Cuatro: Filling up the silhouette

And the final step to get our stencil ready turn it into a mask, would be to fill-in the interior of our main subject.

Use the same hard-edged brush to cover bigger areas [FIG. A]. This doesn’t have to look pretty, we just need to fill all solid areas in black.

A friendly reminder: We’re still working on the Composite Blue Channel of our duplicated layer [FIG.B]. We cannot stress enough how important is to remember which layer and channel you’re working on.

Use a soft brush to have a smoother transition between solid areas and the hair values. Play around with different brush sizes, to tackle smaller details.

Remember: White areas will be totally erased once we create our mask. Black areas will remain opaque and grey tones will create different ranges of transparency, wherever we leave them.

Affinity comes packed with a nice range of basic brushes; but, in case you wanna use the exact same brushes we used here, feel free to download them from the link below.

You may also want to rely on the Pen Tool from time to time, to fill-in regular edged sections, like arms, clothing, etc.

In this case, I didn’t want to mess up her arm shape with a regular brush and my shaky hand.

So I created a path with the Pen Tool, then chose Selection from the Context Toolbar at the top and then, painted inside that selection, without worries.

You should end up with a silhouette like the one shown above.

And we’ve just finished the most time-consuming part. You’ll see in the end how rewarding it is, having a pixel-perfect stencil to create a natural and visually dynamic mask for your subject matter.

Here, you won’t have to guess with auto selections and such. You’ll be creating a faithfully reproduced silhouette, out of the actual values of your image.

Tip: After following this process, it won’t hurt to give an extra Levels pass to your finished stencil, JUST to make sure you have pure white levels around the silhouette. You don’t want to have ‘muddy’ values messing up the final result.

Step Cinco: Creating the Mask

This will be the easiest step of all. Go back to your Channels Panel and Command-click (Mac), Right-click (Windows) on the Composite Blue channel we’ve just edited, then select the option Load To Pixel Selection.

Now, we need to invert this selection. otherwise, the mask will erase our model, instead of the background.

Go to the Layers Panel, hide the top Layer (Selection) and select the bottom layer, which contains the original unmodified image.

From the Channels Panel, let’s make all composite channels visible again, by clicking the icon shown in the image above.

Finally, go to the bottom of the Layers Panel and click/tap on the option Mask Layer. Congratulations!, you’ve applied a clean and pixel-perfect mask to our model and now you’re ready to add any background you like.

Step Seis: Optional integration trick

Sometimes, when putting a background behind your image, this will show a pretty ugly edge or fringe around it. This will make it look flat and ‘muddy’.

We could use Defringe…, Remove White matte or Black matte to make the edges look better. However, we’ve found a way that could give you more control on how your image gets integrated with the background.

Before

Above. We can see our model’s hair, presents a washed-out yellowish tone around its edges. This happens because the ambience or atmosphere, under which the photo was taken, don’t match the ambience of our new background.

After

We found a solution we love, because it puts you in control of the ambience you want to give to your photo. And that would be, adding an Inner Glow effect to our masked Layer. Now, that horrible halo is gone and the hair blends naturally with our background color.

Above you can see the settings we used on this particular image. These settings will vary depending on the size of the image, the type of hair; but more importantly, the color of your background ambience. That will define which color you’ll choose for your Inner Glow.

Conclusion

As we mentioned at the beginning, this method is not the only nor the quickest one to accomplish this task of extracting complex shapes. We’re sure there are many excellent techniques for the same purposes out there. However, this pipeline has worked great for us, so we wanted to share it with you; in hopes you can at least, learn a new trick or two out of it.

Homework

Remember: experimentation is key to develop your own skills. Try these techniques on non-human subject matters either; such as: trees, bushes, street cables… the more you practice and study the effect of it on different objects, different backgrounds and lightning setups, the more capable you’ll be to get to satisfactory results more quickly and easily.

Access your Dashboard:

Support

If you have any inquiry about a product/order, you can provide us with an order number and attach some screenshots if you need to.

Just say hi

Enrique, Brenda and Sam, will be more than glad to answer anything you may want to ask!​

Social

We post tutorials, products announcements, sketches, behind the scenes and photos of cats…