Skip to the tutorial
lil cactus

How to use a depth map to blur a background

Advanced7 minutesUpdated

Quick answer

In Lil Cactus, open the photo and choose Layer then Duplicate Layer to keep a sharp original. Choose Image then Generate Depth Map…, wait for the preview and click Create channel. Choose Filter then Blur then Lens Blur…: on Depth map, choose Depth Map as the Source and set Focal distance to 120 for the sample tram; on Aperture, set Radius to 40 px and click Apply. Save with File then Save As then Lil Cactus Project… to keep the layers and depth channel.

The yellow tram before and after depth-based Lens Blur: the tram remains clear while the distant street and sea soften
The tram stays clearer than the distant street. The nearest cobbles soften too, because they are closer than the chosen focus distance. Drag the handle to compare.
Time
7 minutes
Level
Advanced
You need
A photo with a subject and a background that recedes into the distance
Works with
RGB photo layers, including JPEG, PNG and developed RAW photos
Open the sample in Lil CactusUse your own photo

Free, no sign-up. Your photo stays on your computer.

A depth map is a grayscale estimate of distance: white means near, black means far. Lens Blur uses those values to vary the blur across a photo, instead of blurring every part equally.

You choose one map value to keep in focus. Areas with brighter or darker map values soften. The estimate can miss fine edges, so start with a moderate blur and inspect the subject’s outline.

Use a depth map in six steps

  1. Open the photo and keep a sharp original

    Choose File then Open… and open your photo, or open the sample from this page. Choose Layer then Duplicate Layer.

    The Layers panel now has Background copy above Background. Apply Lens Blur to the selected copy.

    File menu with Open ringed
    Open the photograph as a document.
    Layer menu with Duplicate Layer ringed
    Keep the sharp original below the copy.
    Layers panel with Background copy above Background, the copy ringed
    The selected photo copy will receive the blur.
  2. Generate the depth map

    Choose Image then Generate Depth Map… The first use downloads a depth model of roughly 100 MB; wait for the grayscale preview. The estimate runs on your device.

    On the sample, the nearest cobbles and bollards are pale, the tram is mid-gray and the distant street is almost black. These are estimated distances, not the brightness of the original colors.

    Click Create channel. The dialog closes and adds a channel named Depth Map, without changing the photo.

    Image menu with Generate Depth Map ringed
    Generate depth from the visible photograph.
    The color tram photo beside its grayscale depth map, with a pale foreground, mid-gray tram and dark distant street
    Photo on the left, estimated depth on the right. White is near; black is far.
    The Generate Depth Map dialog footer with Create channel ringed
    Create a depth channel for Lens Blur.
  3. Choose the map and focus on the tram

    Choose Filter then Blur then Lens Blur… On the Depth map tab, change Source from None, uniform blur to Depth Map. The field then reads Saved: Depth Map.

    Set Focal distance to 120. This is a map value from 0 to 255, not a distance in feet or meters. The sample tram’s front is around 127 and its windows around 112, so 120 is a useful starting point. Leave Invert depth map unchecked for the generated white-near map.

    Filter menu with Blur open and Lens Blur ringed
    Lens Blur can vary its strength using the channel.
    Lens Blur Depth map tab with the whole Source control and Focal distance 120 ringed, Invert depth map unchecked
    Source: Saved: Depth Map. Focal distance: 120.
  4. Set the blur strength and apply it

    Click the Aperture tab and set Radius to 40 px. Higher values strengthen the blur away from the chosen focus value. Leave Shape at its default Hexagon (6) and Angle at 0°.

    Click Apply and wait for the blur to finish. The tram’s front remains clear, its receding side softens and the far street becomes much softer.

    Tip To revise the blur now, before using the eye in step 5, press Ctrl+Z or ⌘Z and repeat steps 3–4 with new values.

    Lens Blur dialog with Aperture, Radius 40 pixels and Apply ringed; Shape Hexagon 6 and Angle zero
    Radius controls the amount of defocus; Apply commits the blur to the photo copy.
  5. Compare the original and inspect the edges

    Click the eye beside Background copy to see the sharp original underneath. Click it again to restore the blur. Compare the whole photo and the enlarged details below.

    The tram should stay clearer than the distant houses. Check the roof, window edges, lamp and bollards for a halo or a harsh cutout. The map handles thin or small parts, such as the wires and the tram’s mirror, less reliably than broad shapes.

    Layers panel with Background copy’s visibility eye ringed
    The eye switches between the blurred copy and sharp original.
    Matched enlarged crops of the tram side and distant buildings, before on the left and after on the right
    Before left, after right: the tram’s side softens less than the buildings behind it.
    Matched enlarged crops of the far street, crisp before and strongly softened after
    Before left, after right: fine detail in the far street gives way to blur.
  6. Save the layers and export the picture

    Choose File then Save As then Lil Cactus Project… to keep both photo layers and the Depth Map channel. After that, File then Save saves the project. Choose File then Export then JPEG… and click Export for a new finished picture.

    If you stay with the opened JPEG, File then Save writes a flat picture in that format; its first Save opens Save Image.

    File menu with Save As and Lil Cactus Project ringed
    Keep the sharp original and depth channel in a project.
    File menu with Export and JPEG ringed
    Export a separate finished JPEG.
    JPEG export controls with Export ringed
    Export the combined picture for sharing.

Change the focus or blur strength

After comparing or saving, start a revision from the sharp original. Hide Background copy with its eye, select the Background row and choose Layer then Duplicate Layer. The new copy is selected. Repeat steps 3–4 on it with different settings.

Radius controls strength; Focal distance controls what stays clear. In the sample, a focal value of 4 keeps the distant street clearer and blurs the tram instead. The comparison below uses the same Radius 40 in both versions.

For your own photo, try a focal value near the subject’s shade in the depth preview. Adjust it until the subject is clearer than its surroundings, then set the blur strength. A map estimates relative depth, so 120 will not identify the same distance in every photo.

Layers panel with the blurred copy’s eye and the whole original Background row ringed
Hide the old blurred copy, select Background, then duplicate the original.
Lens Blur Depth map tab with Focal distance 4 ringed
A low map value focuses on this sample’s distant street.
Matched whole-photo comparison focused on the tram at 120 on the left and distant street at 4 on the right
Focus 120 on the left, focus 4 on the right. Radius stays at 40 px.

Fix common problems

If a blur is already applied, use the fresh-copy method above before trying these fixes.

The whole photo blurs by the same amount

In Filter then Blur then Lens Blur…, choose the Depth Map channel as Source on the Depth map tab. None, uniform blur does not use estimated distance.

The tram blurs but the background stays clear

The Focal distance is closer to the background’s map value. Repeat steps 3–4 with a value near the subject’s gray in the map; use 120 for this sample.

A halo or harsh fringe appears around the subject

The depth estimate does not follow that edge closely enough. Use a lower Radius. For precise local control, follow the layer-mask method linked below.

The depth preview cannot finish

Read the dialog’s message. The first run needs the model download; check the connection and reopen Image then Generate Depth Map… if loading fails.

What to do next

Depth maps and lens blur: questions and answers

What do white and black mean in a generated depth map?

In Lil Cactus’s generated depth map, white means nearer and black means farther away. Gray values describe intermediate estimated depths; they do not measure feet or meters.

What Lens Blur settings work for the tram sample?

In Lil Cactus, choose the generated Depth Map channel, Focal distance 120 and Radius 40 px. Leave Invert depth map unchecked, Shape at Hexagon (6) and Angle at 0°. Other photos need their own focus value.

Does Lens Blur keep the whole subject perfectly sharp?

No. In Lil Cactus, the blur follows the estimated depth across the subject. A receding tram side can soften more than its front, and fine edges in the map can be inaccurate.

Can I revise Lens Blur after saving the project?

Yes. In Lil Cactus, the project keeps the sharp original and depth channel so you can make another blurred copy. The pixel edit on Background copy has no saved filter-settings dialog to reopen.

Is my photo uploaded when I generate a depth map?

No. Lil Cactus estimates depth and applies Lens Blur on your device. It downloads the model needed for estimation; optional statistics do not include the image. See the privacy policy.