How to Use Matting Levin in GIMP
GIMP’s Foreground Select Tool includes the Matting Levin algorithm, a specialized matting engine designed to extract complex subjects like hair, fur, and semi-transparent objects from intricate backgrounds. This guide outlines how to select the Matting Levin engine, paint strokes to define your subject, and extract a clean foreground mask directly in GIMP.
Step 1: Open Your Image and Activate the Tool
- Open your image in GIMP by navigating to File > Open.
- Select the Foreground Select Tool from the Toolbox, or navigate to Tools > Selection Tools > Foreground Select.
Step 2: Create the Initial Rough Selection
- Click and drag your mouse around the subject you want to extract to create a rough boundary enclosing the subject.
- Close the loop around the subject and press Enter. A colored overlay (usually dark blue) will cover the unselected background area.
Step 3: Switch the Engine to Matting Levin
- Look at the Tool Options panel on the side of your workspace.
- Find the Engine dropdown menu.
- Select Matting Levin from the list (the default is often set to Matting Global).
- Optionally, adjust the Levels and Active Levels settings to balance extraction accuracy and processing performance.
Step 4: Mark Foreground and Background Areas
- Ensure the Draw foreground radio button is selected in the Tool Options.
- Use the brush to paint a continuous stroke across the main body of the subject you wish to keep. You do not need to cover the entire subject—focus on covering the dominant colors and core areas.
- If the background contains complex areas close to the edges, switch to Draw background in the Tool Options and paint over those background sections.
- If you need to refine semi-transparent edges, select Draw unknown and paint directly over the ambiguous boundaries (such as fine strands of hair).
Step 5: Preview and Generate the Selection
- Check the Preview mask box in the Tool Options dialog to see how the Matting Levin algorithm processes the edges.
- If edges are missing or background elements are included, paint additional foreground or background strokes until the preview is accurate.
- Once satisfied with the matte, press Enter or click the Select button in the floating dialog.
- GIMP will convert the matte into an active selection boundary (marching ants).
Step 6: Isolate the Foreground
- Copy the selection using Ctrl + C (Windows/Linux) or Cmd + C (macOS) and paste it into a new layer.
- Alternatively, go to Layer > Mask > Add Layer Mask, choose Selection, and click Add to apply the extraction non-destructively.