Human perception of intensity is proportional to the logarithm of the physical intensity. When light from an image enters our eyes, we do not perceive the changes in brightness proportionally, but rather proportionally to their logarithm. However, the real physical process of dispersion of light by a lens does not care about how our eyes and brain work. Which means that computer algorithms trying to simulate the effect of blurring a sharp contour should operate after translating first the intensity values to linear space. However, it seems they don't, and that is the origin of the fake dark stripe that appears after doing, e.g., a "photo blur" with Gimp on an image like this one:

enter image description here This effect is explained by this youtuber here. And, while this usually goes unnoticed unless you are blurring a picture of the flag of Portugal, I wonder how to do a less unrealistic lens blur using Gimp. The stress is on the words "less unrealistic" because the subject seems to be quite complex, but at least a quadratic average of the RGB values seems to give better results in the examples shown on the YouTube video referenced above.

Remark

I am using GIMP 2.8.18 which is somewhat outdated.

  • In fact good editors do this but not sure that GIMP is a good editor – joojaa Dec 2 at 13:19
  • I remember a similar post... Let's see if someone can find it... – Rafael Dec 2 at 14:38
up vote 1 down vote accepted

AFAIK there is no "photo blur" in Gimp itself (there is a "Focus blur" plugin).

In Gimp 2.10 the Gaussian blur (and other blurs: motion, rotation, zoom) works in Linear space (even if the image itself is in "gamma" mode):

Side by side comparison of 2.8 and 2.10 Gaussian blurs

  • If you want to download the comparison image I have posted in my answer, include it in yours, and add a brief explanation, I will delete everything in my question starting from the word "remark" and on. – Mephisto Dec 6 at 12:27
  • 1
    Replaced with side-by-side comparison – xenoid Dec 6 at 12:45
  • Thank you very much :) – Mephisto Dec 6 at 12:56

Even in editors that do not have color correct filter facilities its possible to do the following.

  1. (optional) Convert image to higher bit depth
  2. Convert to linear space, with one of following methods
    • With either profile to profile conversion (to a linear space with similar color primaries as your original)
    • Un-gamma correct by inverting picture and applying gamma (note there is a likelihood this wont work since many software use a small linear portion in the color slope instead of doing gamma for the full range), then invert again.
    • Or use a cheap trick and apply 1/your gamma.
  3. Apply filter
  4. Then apply either
    • A profile to profile conversion
    • or just gamma correct back with same samme you used previously

Done

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.