Selecting People and Objects in a Photo in Krita

Share

If you're working with photo editing, there are many cases you need to select parts of a photo precisely, specially if you want to remove the background or apply a filter to only part of a photo. Photos are more complex than illustrations, so it's not easy to select just one part of the photo, specially if we're talking about parts that blend with the background, such as semi-transparent materials (be it clothes, hair), hair, fur, etc.

In my experience, the most useful tool to quickly select part of an photo is the "selection brush" tool that you can find in Photoshop and Affinity Photo. This tool works like the magic wand, except it lets you paint over an area, and then somehow it increases the area selected based on what pixels you painted over. Unfortunately, neither Krita nor GIMP has such tool. Photopea, a free online image editor, does have it. It seems GIMP had this tool as an extra feature in a development version in 2.991.

Without it, there are 2 tools that we can use:

  1. The magic wand tool, which selects an area starting from the pixel you click on, that has colors similar to the pixel you clicked on. To use this, we click "inside" the area we want to select, or "outside" in subtract mode to remove unwanted areas.
  2. The magnetic lasso tool, which automatically "sticks" to high contrast pixels. To use this, we draw a line around the object we want to select.

In both cases, GIMP's selection tools are superior to Krita's. This makes sense since Krita is primarily an application for digital art, so it wasn't extensively developed for this sort of task that is mainly necessary when editing photography.

In any case, the general workflow is very simple:

1: using the magnetic lasso tool, try selecting the area around the object. It will probably select some areas outside the object, and not select some areas inside the object.

2: using the magic wand, hold the Shift key to activate the "add" operation, and click on areas inside the object. In its tool options, you can configure the a "threshold" value. The higher the "threshold," the more pixels it will select. In the other words, the "threshold" limits how similar a pixel needs to be compared to the starting pixel in order to be selected. Beware that at high values clicking anywhere on the image selects the entire image.

3: use Edit -> Undo on the menubar (keyboard shortcut: Ctrl+Z) to some correct mistakes.

4: sometimes, it's easier to hold the Alt key to activate the "subtract" operation and click on areas that you do NOT want selected with the magic wand to subtract those areas from the current selection.

5: if you want to select the background, sometimes it's easier to select the foreground object and then invert the selection in Krita.

Unfortunately, this is all you can do in Krita currently. Repeat the steps above until you have selected all the pixels of the object you want selected.

There are a couple of tricks that can help you in some cases.

Previewing Early

If you're going to use the selection to apply a non-destructive effect, such as creating a transparency mask, applying a filter layer or filter mask, or filling an area with a flat color or pattern, it might be a good idea to create the effect before you have selected everything accurately.

These kinds of layers have internal "masks" in them in Krita. Essentially, if you select these layers and draw on them with black, that "erases" the effect, while white applies the effect 100%. This means you can create a filter layer, then slowly select parts that don't seem to have the filter applied and paint them with black or white. By default, you can fill the selection with foreground and background colors by pressing Backspace and Shift+Backspace, so it can be done fairly quickly.

This can save some time since sometimes you don't need an effect to be pixel perfect: it's okay if it's a bit blurry on the edges, because it's not really perceptible.

By the way, you can turn a "mask" back into a selected area by right clicking on it and clicking on Select Opaque in its context menu.

Selecting from Another Layer

In Krita, selection tools like the magic wand work on the current layer by default. It's possible to make them work based on a different layer by marking the layer with a color through its context menu, and then changing the "Reference" option in the tool options of the magic wand to use that same color as reference.

Use Grow and Feather

Sometimes, the magic wand may select one pixel away from the ideal, leaving an "outline" effect on the selected area. For example, if the background is white, and you select the background and delete it, you may end up with a white outline around everything in the foreground. A way to fix this is to use the functions Select -> Grow... and Select -> Feather.... These functions let you grow the selection by a number of pixels, and "blur" the edges so whatever effect you apply fades at the edges..Combined, they can make hard outlines less obvious.

Using GIMP for Selection

If you're struggling with doing a task in Krita, but you still need some of Krita's features, it's technically possible to use GIMP's tools to select an area and then somehow copy-paste the selection into Krita.

To do this:

1: copy the layer you want to edit from Krita and paste it into GIMP.

2: select an area you want in GIMP.

3: create a transparency mask in GIMP from the selection.

4: select the mask in the layers panel.

5: copy the mask.

6: paste it in Krita.

You can paste it directly into a filter layer to replace its mask. If that doesn't work, you can use Filter -> Adjustment -> Cross-channel Adjustment curves... to convert lightness into alpha, and then select the opaque pixels to turn that into selection.

For the record, here are a couple of ways how GIMP's selections tools are better than Krita's:

  1. You don't need to edit the threshold in GIMP, because if you click and drag with the magic wand, it adjusts the threshold based on how far you dragged away from the starting point.
  2. Like all of GIMP's selection tools, the magnetic lasso (called "scissors select tool") is editable. This means you can add points to the lasso or moving it around before it becomes the selected area in the application. Krita's is also editable, but it's easy to mis-click and apply the selection by accident.
  3. GIMP's magnetic selection algorithm is simply better than Krita's. Krita's is very slow with poor results. I assume this could be because Krita's is somehow designed for selecting drawings with high contrast, so it does poorly with photos. In any case, with GIMP, if you edit the magnetic curve, it updates instantly in real time, while with Krita there's no real time update, and it can take a few moments to update the curve after you edit it, and when it updates it's probably going to look wrong no matter how you configure it.

Navigation

References

  1. https://www.reddit.com/r/GIMP/comments/mecovp/trying_out_the_paint_selection_tool_from_gimp_2994/ (accessed 2024-06-07) ↩︎

Comments

Leave a Reply

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