Natural images (photographs) may contain parts, that are very hard to select. We can have partially transparent objects (a glass of water) or objects with a complex shape (trees, hair, fur). Their colors are mixed with other colors in the background.
Refine Edge Tool
Photopea offers the Refine Edge Tool, which can help you with selecting complex shapes. You can start it by choosing Select - Refine Edge, or by clicking the "Refine Edge" button in the top panel of any selection tool.
Your goal is to make a Trimap: mark the whole image with trhee colors:
- Your object (Foreground) with White (fully visible in the result)
- Background with Black (deleted in the result)
- Uncertain areas with Grey
After you do so, Photopea will deduce the transparency of the Grey area (part of it will be added to the Foreground, the rest to the Background).
The workspace consists of two sides. You can paint the Trimap on the left, and you will see the result on the right. Choose the brush size and the color (White, Grey or Black) in the top left corner and paint over the image. The result is updated after you release the mouse.
If you start Refine Edge with no selection, the whole Trimap is Black (so just add Gray and White).
If you start Refine Edge with a selection, the tool will generate a Trimap for you (selected area as White, the rest as Black). Then, just paint with Grey over the areas, that are not selected perfectly (edges of the object).
You can auto-generate the Grey area as a border of the initial selection (between black and white). Simply change the Border value in the top menu.
There are three modes, how the result can be used:
- New Layer: selected object will be inserted as a new layer
- Raster Mask: the current layer will get a raster mask, that corresponds to the result
- Selection: the new selection will be created, that corresponds to the result
Once the selection looks well, choose the Mode and confirm it by hitting OK in the top right corner.