Menu Close

Automatic shadow restoration

It's not really hard to restore a shadow manually with the History brush. It only takes a few seconds. As isolation with a natural shadow is very popular, if you're not isolating on pure white background, you'll probably be restoring shadows a lot. So if there's a way to do it faster, why not? But don't expect to be able to do it automatically without any user interaction. Because Photoshop doesn't know where the shadow is supposed to be located and keeping in mind that shadows can be absolutely different depending on the object, the only knowledgeable person here is you. You'll have to define the area where a shadow should be restored, but we'll let Photoshop handle the rest.

In a normal situation, when you only use the History Brush manually, you have to watch where your strokes land, and if an object has a complex shape, the whole process might take quite some time. Especially if you can't help yourself with straight Shift-strokes, which happens when objects are not standing straight. Speeding this up will be a great advantage for sure. So let me show you how to do it.

Some contents or functionalities here are not available due to your cookie preferences!

This happens because the functionality/content marked as “Vimeo framework” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.

First of all, I'll isolate the image. The process of shadow restoration will be divided into two stages: definition and restoration. You're the one who defines where the shadow should be restored, as Photoshop doesn't know it. To define the area of restoration, use either the Rectangular Marquee Tool or the Freehand Lasso, as they are the fastest. The only thing that is important about your selection is that it should include the object border where it drops a shadow. It may also include any amount of background around, as it doesn't matter at all. Now we're going to transform this selection so that it will not include the background anymore. But this is not as easy as it sounds. You can just click on the selected background with the Magic Wand while holding Alt to subtract it, but this method will not work on other images. You can record the click, but it will be tied to certain coordinates, and the same spot might not be appropriate on other images, as you might click on the object itself. The only place where you can click on every image and be sure that the same click will land in the same place no matter what, is the upper left corner.

Photoshop uses an inverted Cartesian coordinates system, which means that 0 point is located in the upper left corner, not in the lower left. Every image has a 0 coordinate, where X = 0 and Y = 0. So no matter how large your image is, the 0 coordinate will be in the upper left corner. Let's now see how we can do what we need by using the 0 coordinate only. It's a bit tricky, and I could have just put this stuff in a script, but I decided not to do so as it doesn't really matter in this case. The same can be achieved with an action, watch this:

After making the initial selection with the Lasso, I'll start recording an action. You can't really subtract from a selection if there's no selection where you click. So I'll invert the selection by pressing Ctrl-Shif-I. Then I'll hold Alt and click in the upper left corner with the Magic Wand, Tolerance set to 1. This will subtract the background from the selection. But now the wrong part of the object is selected, not the one where the shadow should be. So I'll Invert the selection one more time and click again with the Magic Wand, just like before, while holding Alt. Now we've got what we need. All that's left to do is tell Photoshop to restore the shadow with the History Brush.

There's a pretty elegant way how to make it work. Normally you can't make Photoshop paint with the History brush, but there are two exclusions. First of all, you can fill an area with History if you access the Fill window and choose History from the drop-down menu. The other method is to make Photoshop stroke a path with the History Brush. And this is exactly what we need.

But there's no path, so let's turn our selection into one by right-clicking on the screen while the Magic Wand or any other selection-making tool is active. A list of commands will appear, and I'll click on the Make Work Path command. Tolerance is not very important, 2 is okay. There you go, now there's a path instead of a selection. Now I'll press Y to access the History brush, and it will be recorded in our action as well. You can use current settings or make a Brush Preset of an appropriate size and hardness. So I'll stop recording for a while and show you how to do it.

When any Brush, be it a normal Brush or History Brush is active, change its Hardness to 0 and size to something about 150 or 200, it really depends on your image size. Now click here in the tool tab, next to where the brush size and hardness icon is located, and then click on the icon below the gear icon. This is actually a “Create a new preset from this brush” button. Don't forget to check the “Capture brush size in preset” box if you want the brush size to be fixed there. My brush is now saved with the name Soft Round 150. Now if I want this particular brush preset to be used in my shadow restoration action, I'll start recording again, and after selecting the History Brush, I'll click on this folder icon to access the Brush Preset Manager and click on this brush preset. Now it's recorded, and the action will be using this brush for the process of shadow restoration.

We still have to record the restoration itself. But this is easy. Access the Paths panel. I have it next to my Layers and Channels, but it can also be accessed from the Window menu. There, click on the second button from the left, which is the “Stroke Path with Brush” button. And here's the shadow! But there's a path still hanging there, so the last step will be deleting it. I'll drag the Work Path to the trash can icon in the Paths panel and it will be gone. It's time to stop recording and test the new action on other images.

Isolate the image, make a selection where the shadow should be restored and run the action. As you can see, it works quite well. The deal is that making a crude selection with the Poly Marquee or the Freehand Lasso is faster than carefully restoring the shadow with the History Brush. So when a shadow is typical and doesn't need any attention on your side, let Photoshop do all the hard work!

Open

If you don't want the action to use some particular brush preset with a fixed size, you can skip this step and instead of recording that, just call for the History Brush. The stroke command will use the current settings. This approach gives you more flexibility, but it might also be a bit confusing if you forget to set up the History Brush properly prior to running the action.

A natural shadow is an easy thing, you'll see it when we get to the isolation with an artificial shadow. That's what's tricky!

The automatic shadow restoration action is available in the shop as a part of the manual isolation pack. It also includes an isolating action and a script that checks whether the background is pure white. However, if you have the time, I encourage you to create your own isolation pack as the process is thoroughly described in the videos.

Next: Isolation with an artificial shadow

Top

On this website, we use first or third-party tools that store small files (cookies) on your device. Cookies are normally used to allow the site to run properly (technical cookies), to generate navigation usage reports (statistics cookies) and to suitable advertise our services/products (profiling cookies). We can directly use technical cookies, but you have the right to choose whether or not to enable statistical and profiling cookies. Enabling these cookies, you help us to offer you a better experience. If you choose to disable cookies, you won’t be able to watch the embedded videos. Cookie policy