One of the major tasks in photo editing or retouching comes in the form of removing the background in software like Affinity Photo. You might need it to remove the background completely for a product photo or to add a different background for a composite, or do multiple-image composite in the form of matte painting. Magazine editors will also often need this technique in order to wrap text nicely around the cut-out image in an app like Affinity Publisher.
You might have already done background removal at some stage in life, or you are going to do it at some point. Affinity Photo provides several tools for background removal. Let’s look at them one by one.
Our Tough Sample for Removing A Background in Affinity Photo
Yes, this beautiful hair, and as we look closer at our sample image, we realize what a beautiful mess it is going to be. Hence, I have picked this image to demonstrate the background removal techniques. If you can remove the background from this image, you can remove it from any image. Once again, just look at the beautiful long fur of this Scottish Highland cow.
We are going to look at them further in detail, perhaps again and again. So the first lesson – background removal is about patience, and also about knowing the tools. One tool might not be enough to give you the result, so you may need more than one tool for the same purpose. This, at times, can be a time-saver.
The Pen Tool is Perfect for Removing the Background in Affinity Photo – for Some Images
There’s nothing better than pen tool for point-perfect selections. It works wonders in many images with simple lines and edges. Though, as you will reach up to the hair of this furry model, you will realize the problem with pen tool. The hairs are too thin, require too many curves, and it will be a constant mix of making a mask, and then removing parts of it, until you get too old to use that image – I mean until you get the perfect masking. But it is an important lesson to learn pen tool. It helps in some selections which are tricky otherwise. So let’s pick a simpler image to practice pen tool – or an image more apt for pen tool selections.
Now let us take a look at our second sample image, one of my early architecture images. As you will see for an image like this the pen tool is indispensable in order to remove the background using Affinity Photo.
This seems to be a straight-forward straight line selection, right? Perhaps not. Let’s start from the top-right corner of the image. The image doesn’t seem to be as straight-forward as it seems. That’s why it has been chosen.
Now let’s start working on the image from the corner. We bring it to the point where there’s almost a jump. As long as you have a straight line, you can go on clicking. Once you have a curve, you will have to press ‘ctrl’ or ‘cmd’ and left-click the place where you want the next point. Now, without releasing the mouse click, move the mouse in the opposite direction to where you want your curve to be.
In case of a point, normally, there are two handles. One controls the incoming projection, and the other controls the outgoing projection.
In the case of straight lines, it isn’t needed. But when dealing with curves, it becomes important. If your curve is going to be in the same direction, you can continue simply as suggested above. However, if your curve is changing sides, you can press ‘ctrl’ or ‘cmd’ (node mode enters), and then press ‘alt’ or ‘opt’ key and click the handle you want to remove, like to remove the outgoing projection. Now the curve will be controlled only by the incoming projection of the curve before.
Anyway, let us continue in our search for the perfect tool for using Affinity Photo to remove the background with the more diffucult image of a furry animal.
Related articles: Check out our other Affinity Photo Tutorials
Specific Tone/Color Selection Tools
There are different selection tools based on tones and colors. The four of them are:
- Select by Color Range – where you can select reds, blues, and greens. Absolutely no control, but it is handy in some selections, especially while toning.
- Select by Tone – where you can select mid-tones, highlights, and shadows. Again, no control. But it has its uses too.
- Select by Alpha Range – when working with PNG and TIFF files, you may have transparent areas, opaque areas, and the ones between them. This selection caters towards those.
- Select Sampled Color – where you get all the control. Let’s try clicking that.
There are four different modes, and a tolerance slider. The RGB Mode lets you select colors based on sampling. The CIELAB Mode is about perceived colors, and is more natural and intuitive selection of colors. Intensity Mode helps in selecting image based on intensity. And the Alpha Mode is based on transparency.
As you may notice, the first two modes are basically the custom version of ‘Select by Color Range’, the third is a custom version of ‘Select by Tone’ (the pixel intensity in Affinity is measured by turning the image grey-scale), and the fourth is the custom version of ‘Select by Transparency’. Basically, it has all three modes, but with custom sampling and tolerance tool.
Custom Sampling is when you click a random sample in an image. Like we have clicked the hair portion. When you click and drag, the selection gets expanded. And when you alt + click, it gets reduced. The tolerance is to simply select how much or how less of the similar color/tone selection you require. As you might notice, this isn’t the right way for selection in this image because of the different shades of hues in the hair. Furthermore, the background is merging with the subject in a few areas. However, if it was a simpler case, it would have worked like a charm.
Flood Select Tool (W) does a similar job to sampled color, albeit faster. Although it lacks the tolerance control, and in fact any control. It is simply click to select, ‘alt’ or ‘opt’ to remove from selection, and ‘ctrl’ or ‘cmd’ to add to selection.
Important Tip: Add to the selection step by step
You might have noticed by now that no selection works perfectly. It might appear, even after finishing everything, that no selection works on the whole. That’s why a pro-tip. Faster selections are often a result of knowledge of the best tool for the job. So if there’s a situation that can’t be dealt with any other tool, an editor will move to the pen tool and finish it off rather than trying different easier solutions. And he will choose easier and quicker solutions for the selections that they work. In the end, it is about adding all the selections to make a whole, and it often makes the job easier.
The Magic Tool – Selection Brush Tool
I mentioned that there may not be any perfect tool for removing background in Affinity Photo, and yet I introduce you to the Selection Brush Tool (W) as the magic tool. Firstly, it is a magic tool considering all it can do. Secondly, it has its drawbacks and shortcomings. More on that later. For now, time for some magic.
Selection by the Magic Tool is simply about clicking and dragging. So we will slowly click and drag from the edges towards the bottom right and then move upwards towards the face of the cow. Slowly, we will drag towards the hair. The idea is to make a rough selection around the areas where we aren’t sure yet. It will not be a perfect selection, especially in areas like the hair. Once we are okay with our selection, almost perfect at most places, while not being okay around the edges, we hit the magic button.
Refine, on top, is the magic button for selections. It gives us control that can help us achieve almost any selection. When we click Refine, the dialog box opens with an overlay mode, the selection being visible, while the non-selection being red.
The refine adjustment brush is currently in Matte mode, which gives control to Affinity Photo’s algorithm in selections. This is an ideal start for us. Now we slowly start painting around the hair area, letting Affinity do its smart selections. As you might see, the selection is being re-recorded, and the edges being refined already. Let’s do this all over the edges of the beautiful hair.
The important tip is to try and start the brush from the areas you are sure to be selected, even if it gets repeated, and slowly hover around the edges. Also, take small selections. You may change brush size with [ and ] as the need arises. For delicate areas, small brush size is a great idea.
Now when you might think that this is so easy, and we are getting the result – we change the mode to something else. One between black and white matte will give you an idea about how sharp or accurate your selections seem to be, and also if there’s any mess around that needs cleaning up. It appears that the selection is accurate here, with a minor issue here and there. But let me go ahead and explain further points in this image anyway.
By choosing “Foreground” in the adjustment settings brush, we tell Affinity Photo that this is a part we want in our selection. The algorithm of Affinity will be at work, but it will take care to notice the larger portion. So if your brush is not accurate most of the time, it might result in problems around the selections. Therefore, a smaller brush and smaller strokes work better. Next, we brush over some hair area which clearly seems lost, and red curves appear. We try and paint over them with a very thin brush. It might be accurate, but it might also select extra portions. With the “Background” mode of the refine adjustment brush, we can remove the extra portions from across the image.
Now one final step towards better selection is to work zoomed in on the hair and check the missing link between hair. And just do a brush movement in Matte mode only. This step isn’t mostly needed, but in difficult selections, this can help. Very small strokes for areas where you see something missing.
Here, an important part worth discussing is that you can’t do a 100% perfect selection. In such cases, choosing for complete selections and letting go of some selections that are frizzy is a good tip. Also, your selections need to appear complete. So if you don’t select a small strand of hair, don’t select it at all. Don’t start the selection and then end it abruptly. The idea is to cheat smartly because we can’t be perfect.
When we finally hit apply and click on ‘mask’, we might still notice improper selections. We now have to paint over selections with a brush on the layer mask.
Select a white color, activate the layer mask, and begin to paint in the selection. It solidifies the selections, thus taking out those small unwanted parts by making them complete. The selection appears much fuller now after the brush. Now let’s try putting a background behind the selection.
It appears to be alright, this selection. But not quite. Let’s see how to improve. Also, remember, you have to let go of certain areas in such selections that don’t look good, like on its right cheek (left in photo). You can get rid of this area by deleting it from the mask, and make sure the final selection looks natural.
However, if you are not satisfied with your result, there’s a way to improve the selection even further.
Let’s start from the start. Duplicate the image file in a new layer. And instead of using the Magic Tool directly, we would first work on image to improve our chances of selection. Here, I simply add a contrast, and then use the same method as above. I’m working quickly over the hair area. Now see only the hair area of the image, and how it compares with the previous version. Reason? It is because contrast somehow improves the image in focus, while the background, usually slightly blurred, gets further out of focus. This gives the software algorithm something more to work with.
After that, you can remove the contrast layers. The same method will work even in case of other adjustments like layers, curves, or saturation – anything that creates more separation and adds more contrast to the image, thereby making the selection for the software easier.
Did You Know: You can use the refine edge tool with any of your selections.
How? Simply change the mode to Selection Brush Tool after your selection is done. The ‘Refine’ button will appear. Now do all the adjustments you want to do, and it will work much like the same way. So you can do this image also by using the pen tool, roughly, and then hitting the refine tool.
Pen tool is the perfect tool. Selection tools by Color, Tone, Opacity, or Sampling, also have specific usage. The selection brush tool, however, is the ultimate tool. The ‘Refine’ tool in the Selection Brush Tool is how complex selections like hair are done in Affinity. For most other selections, the pen tool is apt. Why not selection brush tool for everything? Let’s go back to our architecture image to explain where it fails.
As you can see, it can mess up big time, especially when similar hues and tones are there. For such images, pen tool will give quick and accurate results, while adjusting the selection here may end up taking much more time without giving proper results. What if the subject is mixed? As mentioned above, you can simply add up different selections, by selecting by parts, instead of full selection in one go. So easier areas with Selection Brush Tool, slightly difficult with Pen Tool, and the ones like we worked on with any selection followed by ‘Refine’ tool.
As I have demonstrated you can remove the background on even the most difficult images in Affinity Photo.
Not an Affinity Photo user yet? You can get Affinity Photo here.