Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Bug: Custom filter darkens the image when it shouldn't

Community Beginner ,
Sep 21, 2025 Sep 21, 2025

Photoshop version 26.10.0.
The weights of the kernel sum up to 841, so the Scale being set to that value should not change the lightness of the image, but it does. The weights are:

{

1, -5, -21, -5, 1,

-5, 25, 105, 25, -5,

-21, 105, 441, 105, -21,

-5, 25, 105, 25, -5,

1, -5, -21, -5, 1

}
FYI, this filter was built from the following separable 5x1 kernel:

{ -1, 5, 21, 5, -1 } with Scale set to 29.

Which works fine when first applied horizontally then vertically.

Bug Unresolved
TOPICS
Windows
94
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
3 Comments
Community Expert ,
Sep 21, 2025 Sep 21, 2025

I can replicate the issue you are seeing with an 8 bit/channel image set to R=G=B=128 in sRGB colour space. It darkens to R=G=B=118.

However, I suspect this is due to rounding errors when using just 8 bits/channel in the calculations. Indeed there is a jump between setting the scale at 820 which lightens the image and 821 which darkens it. This would appear to confirm the issue of insufficient steps in the underlying calculation.

Using 16 bits/channel, the same filter does not change the image lightness. Starting in 16 bit/channel with R=G=B = 16448, applying the same filter gives R=G=B=16448 i.e. no change as would be expected.

Dave

Translate
Report
Community Beginner ,
Sep 21, 2025 Sep 21, 2025

@davescm I don't understand where the rounding error comes from, from a programming perspective. If you're applying the filter in the sRGB color space straight away (and don't linearize the colors), you just add all of the (weights[j][i] * pixels[y][x]) together and divide at the end by the scale, right? Where's the precision issue?

Translate
Report
Community Expert ,
Sep 21, 2025 Sep 21, 2025
LATEST

@Pierre Charpentier I am using empirical evidence to form that view, hence my words 'suspect'. I am not an Adobe employee and therefore not party to how the operation is actually programmed internally and whether any internal conversion is involved. I do know, from previous discussions, that internal calculations are often carried out in Lab colour space therefore, for those, conversion prior and post operation is involved. Only an Adobe developer could confirm whether that is the case here. 

I agree with you that the result is unexpected, mathematically.

Dave

Translate
Report