How to Quickly Remove Dirt Spots Using Median in Photoshop


You’ve rolled out your white background for your shoot; whether it’s vinyl or paper. It’s a bit dirty from shoes, but you’re under pressure to get the shoot done, so you carry on regardless. When the shoot is over and the photos are back on the computer, that’s when you see how bad it really was. The scuff marks, the footprints, the stray hairs, these are going take ages to clone out. You’re sorry now that you didn’t clean it up, or cut off some paper. Sigh. Better just getting going on the processing.

But wait! There’s a better way.

It doesn’t have to all be cloned out. There’s an easy way, using one of Photoshop’s lesser known tools called Median. Median is a form of blurring, where groups of pixels get changed to the middle value of the pixels. Higher values are reduced, lower values are increased, averaging out the values.

Steps for cleaning up your white background

So your floor has specs of dust, hair, and just general footprint dirt on it.


Step one – duplicate layer

Duplicate your background layer by dragging it on to the New Layer icon at the bottom of the Layers panel.

Cleaning a white background 2

Alternatively, use the shortcut Command/Control + J. If you’ve got a set of layers, then use the shortcut Shift + Cmd/Cntrl + Option + E to stamp them into a new layer.

Step two – Median

Go to Filter>Noise>Median.


Move the Radius slider until the dirt disappears. I’ve used 10 here.

Cleaning a white background 4

Step three – apply a layer mask

If you’re not familiar with Layer Masks, you can use the Erase brush to bring remove the areas you don’t want blurred, but I recommend using Layer Masks.Cleaning a white background 6

A white Layer Mask reveals everything on the layer, while a black mask conceals the contents of the layer. You want a black mask for this layer, so hold down the Option key on Mac (Alt for PC), and click the New Layer Mask icon at the bottom of the Layers Panel. A black mask appears on the layer and the Median filter is concealed.

Next, select the Brush Tool (or use the shortcut B), then hit D for Default colours. Then use the shortcut key X to swap foreground and background until the foreground (i.e. the top swatch in the tools panel) is white. With a soft brush, paint over the dirt to reveal the Median filter’s affect. Don’t go too close to the edges of your subject. If you make a mistake, press X to swap the brush to black, and paint it back to hide that area again. This is the beauty of Layer Masks, you can reveal or conceal over and over again without having to undo (this is called non-destructive editing).


This trick isn’t limited to backgrounds. You can be use it on any areas of continuous tone, for a quick result. I’ve had to use it on skies, where I’d accidentally used a dirty sensor cleaning brush and left marks on the sensor. Here’s how you could fix such an issue using Median.

Fixing a dirty sky with Median

As with the background cleaning technique, start by duplicating the background layer. You can see the issue quite clearly in the sky (below), and in the smooth parts of the river.


Next, apply Filter>Noise>Median. The issue will need a far higher Radius than the background required.


Select only the sky area

Next, hide the Median layer by clicking on the eye on the layer, then select the layer underneath. From the tools panel, choose the Quick Selection tool or press W. From there, drag the cursor along the sky, close to the buildings. Because of the hard edges against the sky, the selection is made easily.


Next click “Select and Mask” (outlined in red above). You’ll see the sky clearly, and the rest of the image faded. Brush the cursor over the tips of the buildings, street lamps and other things that need to be protected from the blurring effects of the Median filter. Press return (enter) to create a selection with marching ants visible.

Turn the visibility back on for the Median layer. Press the Layer Mask icon in the Layers panel to create a mask.


You will see areas where the Median filter has blurred edges, so you’ll need to brush the mask with a black brush to hide these. You don’t need to be precise, using a large soft brush along the edge of the buildings will make it a quick job.


Remove the Median where it has blurred the edges of the city buildings.

The final part is to go along the water with a white brush, set to 50% Opacity, to hide the dirt in the water.


The final image looks far better than the original.


Much quicker than manually cloning the dirt out, right?

Have you tried this method, how did it go? Do you have another fast way of removing dirt? Please share your thoughts in the comments section below.

Read more from our Post Production category

Sean McCormack is a Fuji X Photographer and author based in the Galway in the west of Ireland. He's the author of The Indispensable Guide to Lightroom CC. When he's not writing or creating YouTube content, he shoots people, places and even things.

  • Brenda2124
  • David A. Neff

    Why not just use the Healing Brush tool? No masking required and it will work on images where there is detail. Not all images have soft backgrounds like a sky or studio backdrop.
    Nice to know this technique though as it is one way I had never heard of to remove dirt spots 🙂

  • Sean McCormack

    Hi David, you don’t need brush accuracy with this method. The background isn’t strictly even, so you would need to select your clone source as you go. As you’re just brushing a mask with this, it’s much quicker. It’s possible to use this method to remove dust and dirt from clothes, which is more annoying with healing, because you have be accurate to match patterns in fabric.

  • David A. Neff

    I tried your method with an old slide that I scanned which has a good amount of black dust spots/lines in the scanned image. I will agree that this method works, but when I paint in the blurred dust from the Background Copy layer it is noticeably blurrier than the original Background layer. I can see how this would benefit on clothing as it can be hit or miss using the both the healing brush and the spot healing brush tools.
    I personally have been using an old freebie plug-in from Polaroid that was bundled with their scanners many years ago. It is called Polaroid Dust & Scratch Removal and does a pretty darn good job of just removing light (white) or dark (black) dust spots without softening the image.
    None the less, it never hurts to try and learn new techniques. Thanks for the tutorial.

  • lenochka_gordon

    I usually gain something like 6-8 thousand bucks every month for freelance tasks i do at home. If you are considering to finish easy at home task for 2h-5h every day from your living room and make good salary while doing it… Then this job opportunity is for you…


  • Jennifer680

    I get paid roughly 6k-8k dollars /month with an internet task i found on the internet. Anyone eager to work easy freelance tasks for 2h-5h /a day from ease of your home and get good salary in the same time… Then this task is for you…


  • jennifer_taylor_92

    I usually gain around 6 thousand-8 thousand dollars monthly with an internet task i found on the internet. Anyone ready to do simple computer-based task for 2h-5h daily at your home and make decent checks in the same time… This is ideal for you… usually gain roughly 6-8 thousand bucks every month from working on the internet at home. Everyone considering to do simple freelance task for few hours /day at your house and gain valuable checks for doing it… This is a task for you…

  • marci.milano

    I usually gain around $6k-$8k every month for freelance tasks i do at home. So if you are prepared to do simple online task for 2h-5h a day from your house and get valuable income in the same time… This is ideal for you…

  • lucia_hall

    I make around $6k-$8k /a month with an internet task i found on the internet. So if you are prepared to work simple computer-based task for 2h-5h daily from ease of your home and make decent benefit in the same time… Test this work

  • loryjohnson

    It’s been one yr since I finally abandoned my old work and it was a best decision i made in my life… I started doing work over internet, for a company I found on-line, for a few hrs /a day, and I make much more than i did on my office work… My payment for last month was for $9k… Awesome thing about this job is that i have more free time with my family…

Join Our Email Newsletter

Thanks for subscribing!

DPS offers a free weekly newsletter with: 
1. new photography tutorials and tips
2. latest photography assignments
3. photo competitions and prizes

Enter your email below to subscribe.
Get DAILY free tips, news and reviews via our RSS feed