Automated Healing in Photoshop for Dirty Sensors and Lenses
Thursday, August 9th, 2007A few weeks ago I had a very big problem with the 400+ photos I had taken during a photo session. The photos seemed fine as I was chimping with the camera’s tiny LCD screen. After the shoot, however, I loaded the photos onto the computer and was horrified to find that all of the photos were covered in nasty little blotches. A LOT of nasty little blotches. Since I am religious about cleaning my lenses with a microfiber cloth, I could only conclude that the evil was inside my camera. I cleaned the sensor immediately with the rubber-bulbed air blower, but I was still stuck with a batch of spotted photos.
What to do? Help me, Photoshop, help see the way! Let me record an action to remove all the garbage while I go sit on the couch and read this James Ellroy novel!
Photoshop, however, was having none of it. For splotches, stains, pimples, moles, blackheads, burnt pixels, stray hairs, scratches and other offensive detritus, I usually use the Spot Healing Tool in CS2, moving to the more accurate Clone Stamp Tool if the splotch is too close to a background of a vastly different color or texture. Unfortunately, CS2 will not let you automate the Spot Healing or Clone Stamp Tools. What you can automate, however, are selections. So here’s what you can do:
1) In your Actions pallet, hit the button to create a new action. Name it. Hit Record.
2) Using the Lasso Tool, go to each little black dot and circle it, making sure that you are enclosing the entire splotch but no more. Since you’re trying to fix a large batch of different photos, accuracy is important in this step. This is a laborious process, but remember that you can toggle between Add to Selection and Subtract from Selection with the Alt key. Make sure, though, that you are adding to the selection every time you start on a new blotch, not subtracting from or replacing the selections you’ve already made.
3) Choose Filter > Noise > Dust and Scratches. Use the slider to choose a radius that dissolves the spot. In my case it took a radius of 29 to eliminate the blotch completely.
4) But now we have a problem. The area is now so smooth that it sticks out obtrusively. We need some texture. Choose Filter > Noise > Add noise (Distribution: Gaussian, and Monochromatic checked) to make the spot look less uniform. Use the slider to match the noise texture to that of the surrounding area. In my case I needed .4%.
Stop your action. Now you can Automate > Batch the whole action for a group of photos. Choose your action from the batch dialog, select your Source folder. Click “Suppress File Open Options Dialogs” if you are automating RAW photos (remember that if you have altered these previously either in the RAW dialog box and clicked “Done” or applied a saved setting to them in Adobe Bridge that those settings will be maintained in the batch processing). Choose your Destination folder. I always keep a generic Destination folder called “AUTOMATIC PHOTOS” where I put all my automated batch photos. That way any action I create will always save to that file, so I can go back and use those actions later without errors with the Save command.
Remember also that if you are shooting photos in portrait format (i.e. vertical frame), and then take a few in landscape format (i.e. horizontal frame), then the spots will not match up in exactly the same place on the photos. If you have selected the blotches in portrait format, you’ll need to rotate the landscapes appropriately and do one of the following:
1) Separate the landscapes from the portraits and run them with a different action whose first step will be Image > Rotate Canvas > 90° CCW (or CW, depending on how you held your camera in portrait format, but I always shoot with my right hand on top), and the last step (before your Save and Close actions) will be to rotate it back to normal with Image > Rotate Canvas > 90° CW.
2) Probably the easier option is to choose all the landscapes in Adobe Bridge, rotate them before batch processing, and then rotate the JPGs back to normal again when you’ve finished processing.
I’ve posted the action so you can see what I’m doing. You can download it here. Obviously this will not fix your photos because your smudges will not be in the same places. It’s just so you’ll have a concrete example of what I’m doing. I always like it when people post actions, settings or PSD files to download. Sure, explanations are great, screenshots are great, but you could really get away with a lot less if you just posted the file directly.
If you’ve never loaded action before, just click on the side button of your Actions pallet and choose Load Action.
Note that this is not a panacea for your splotchy photo ills. You will still have to go back and fix photos (using the Spot Healing or Clone Stamp Tools) where the Dust and Scratches filter has blurred textures like clothing and hair, leaving equally annoying blotches. If you have more time and patience, instead of batch processing you can open the photos individually, run the action and analyze the damage done at the moment. That way you can use the History Brush to wipe away the new Dust and Scratches blotches and fix them with the Spot Healing or the Clone Stamp Tools.




