In this Natalia Taffarel presentation, she explains that photoshop high-pass filter “skips the edges” of the histogram and that for creating an accurate high-pass filter we have to apply -50 contrast legacy on the image before applying the H-P filter.

I made two copies of the image and apply 10 gaussian blur in the first and in the second I applied -50 contras legacy and then a 10 H-P filter. If what Natalia says is correct, the two layers have to neutralize one another and create the original image again. I set the opacity of the upper layer to 50 and the resulting image lacks a lot of contrast.

Can someone share some insight on the subject?

Here you can see the Natalia explanation. It starts in 23.05

**Answer**

Surely most of us understand well that the effect of a low pass filtering can be neutralized by applying a complementary high pass filtering to a copy of the same image and by adding pixel by pixel the RGB values of the both filtered versions.

To clean someone’s portrait image we apply Gaussian Blur to the image as a special form of low pass filtering and combine it with a high pass filtered version. If we delete disturbing sharp edged spots from the high pass filtered version we get perfectly sharp original, only without those spots because the low pass filtering blurred them invisible and they didn’t get restored because they were deleted from the complementary high pass filtered version.

The method is well known: Make a copy with for ex. 10 pixel Gaussian Blur as low pass filtering and another copy with 10 px high pass filtering with 50% reduced contrast and use blending mode Linear light to combine the filtered versions. The contrast reduction must be done in legacy mode or with curves around 128 to avoid non-linear compression.

Unfortunately in Adobe’s documentation there’s no quantitative numerical information why this frequency separation works. Blending mode and filtering math is explained only qualitatively. That leaves plenty of room for guesses which has resulted anything but clear explanations by the users.

The problematic teaching video isn’t an exception. It states that Photoshop’s high pass filtering sucks, it skips the edges of the histogram. The meaning of this is not clear. The HP filtering seems to work perfectly, Adobe has only done a couple of workarounds due the lack of negative RGB numbers.

I have made some tests to find how Photoshop’s HP filtering actually works, how it is paired with the Gaussian Blur and what does the blending mode Linear Light.

My first assumption is that Adobe doesn’t use any common Fast Fourier Transform based HP filtering. I believe the filtering is calculated from Gaussian Blur, which isn’t especially heavy math job. Blur is only a weighted average of adjacent pixels, much simpler than FFT. That explains also how Gaussian blur and the HP filtering can be so perfect complementaries.

Intuitively one can easily see that the high pass filtered version of an image can be made by subtracting from the original image a blurred version of the same image.

Of course that’s based on the fact that Gaussian blur is a form of lowpass filtering. It’s far from ideal, there’s no sharp cutoff frequency, the attenuation of high frequency components grow slowly as the frequency increases.

To illustrate the HP filtering formation we can write the following equation:

H=R-B

R is the set of original RGB values in the image, B is the set of values in the blurred image and H is the result of pixel- and channelwise subtraction, the values in the high pass filtered image. In Photoshop normal 8 bit deep images cannot have other numbers than 0…255, there’s no negative numbers. The equation must be fixed by scaling and inserting an offset.

The fixed equation: H=0,5(R-B)+128

The zero is shifted to 128 and the numbers stay in range 0…255 with the following equation, no matter which are the original and blurred RGB values.

In large uniformly colored areas this produces 128 to all RGB numbers, the color is mid-grey. At sharp edges between 255 and 0 this can give more, but the result isn’t the extreme 0 or 255 because the blur is a weighted average of adjacent pixels.

We can produce the homemade high pass filtering 0,5(B-R)+128 easily with adjustment layers and blending mode ADD or SUBTRACT. The latter is trivial, but ADD works as well with different adjustment curve. It’s also trivial when we reorder the terms in the formula:

H = 0,5(R-B)+128 = 0,5R+(128-0,5B).

Let’s test it and compare to Photoshop’s own high pass filter:

This is a high zoom screenshot of 5 px blurred image. The original is in the bottom layer and it contains only full black and white with sharp horizontal border in the halfway.

Our homemade HP filtering with blending mode ADD and adjustment layers is the following:

Curves adjustment layers have “next layer only” -switches ON. The upper of them makes 128-0,5B and the lower makes 0,5R. The blending mode of the blurred layer is ADD.

The RGB values just around the border are 187 and 69 further away the values decay to the expected 128.

The next image is the same, but filtered with Photoshop’s high pass filter:

There’s one clear difference: PS’s own filter makes more contrast, the RGB values just around the border are 246 and 10. Their difference is 236. Our homemade high pass filter generated only 187-69 = 118. That’s 236/2.

My interpretation is that Adobe doubles the contrast. That’s made by omitting the multiplication by 0,5 in the calculations. It makes sense because it means bigger effective resolution. It’s better utilization of the available 256 RGB values. The boost doesn’t cause clipping because in the homemade HP filter the max difference at filtered sharp borders is always less or equal than 128.

We cannot omit the multiplication by 0,5 to double the contrast because we haven’t internal headroom for the calculations. Every intermediate and final result must fit the range 0…255 or there’s clipping.

We can compare our own HP filtering result to Photoshop’s filtering result by applying blending mode difference:

On the top there’s a curves layer which compensates with contrast reduction the assumed +100% contrast boost in Photoshop’s HP filtering. The filtered copy of the original has blending mode Difference.

The result is flat zero as assumed. There’s no difference. We have found how Photoshop’s HP filter works.

The 50% contrast reduction which was done in the teaching video compensates the contrast boost in PS’s high pass filtering and turns the filtering the same as our home made filtering. The reduction can be done before the filtering because the filtering and the contrast reduction are linear operations as long as one doesn’t use Brightness and contrast adjustment. It’s linear in the Legacy mode, but normally it compress dark and bright tones non-linearly for subjectively more attractive effect in photo editing. That’s also said by the video lecturer.

There’s still left the quantitative explanation why blending mode Linear Light is the right way to combine the blurred and high pass filtered versions.

Intuitively one wants to recreate the original RGB values by adding High pass filterd version to the blurred version. That’s perfectly OK, but Photoshop’s HP filtering has added offset 128 to every filtered RGB value in the filtering. We cannot simply use blending mode subtract to remove the offset because all intermediate results must stay in range 0….255. Photoshop’s internal calculations don’t have that limitation.

We can explore blending modes with black to white linear gradients. Here’s blending mode ADD.

All pixels at the diagonal and downwards should be full white (=255) and the color picker shows it true. The brighter line just on the diagonal is made in display control processing. It’s obviously a kind of subjective enhancement attempt and I haven’t found a way to switch it off.

Changing the blending mode to Linear light gives different image. It really is somehow linear because there can be seen straight form lines caused by linear gradients:

The result becomes the same as with mode ADD, if one applies a curves layer to the topmost layer:

The topmost gradient has still blending mode Linear light. The curve (affects only to one layer) multiplies everything by 0,5 and adds 128 to the result. The result is the same as the gradients were blended with ADD without other adjustments. Thus we can reversely write a formula for Linear light:

L=2(T-128)+G where T is the RGB value in the top layer and G is the RGB value in the bottom layer.

(I must admit that finding those 0,5 and 128 needed no genius. I had already seen that the combination of complementary filterings works with linear light. After believing that “linear light” does something linear, the only possibility was function ax+b. a=0,5 and b=128 were found by trial and error)

So, combining the filtering should work with linear light. Our home made high pass filtering should be usable “as is” without contrast reduction which is needed for Photoshop’s HP filtering. Let’s insert the complementary filterings to the linear light formula:

L=2(T-128)+G = 2((0,5(R-B)+128)-128)+B = R, as expected.

The same can be presented also by making the combination in practice:

I have tried it also with more complex images and it works with them too.

**About the asked things:**

Photoshop’s high pass filter doesn’t suck by skipping histogram edges. The 50% contrast reduction is needed to compensate Adobe’s attempt to utilize better the available number range 0…255

Opacity reduction is a misunderstanding. It isn’t a proper substitute for blending with linear light.

**Attribution***Source : Link , Question Author : Samuel Flores Sanchez , Answer Author : user287001*