Recent

Author Topic: Topic: Difference between Photoshop and BGRABitmap Blur  (Read 3145 times)

Sanem

  • Full Member
  • ***
  • Posts: 179
Topic: Difference between Photoshop and BGRABitmap Blur
« on: July 25, 2016, 09:08:06 am »
Hi
I have tested a normal blur in BGRA(as you can see in my code attached here: https://www.dropbox.com/s/dh5ehj5jh8h60lh/BlurTest.zip?dl=0 ) which as the doc of BGRA says is  Gaussian-like, and with the same picture i got a different result from exactly the same blur(Gaussian an same Radius) in Photoshop, and i dont know what is the difference between BGRA and Photoshop algorithms for managing the blur? as you can see in screenshots (Same folder which i attached contain the screenshots in Pic folder), first one is my orginal Pic and second is blur in Photoshop and third is result of BGRA blur with different radius from Photoshop blur radius.
and as you can see it seems that the Radius in BGRA is something different(smaller i think) from photoshop radius, and i tested other Radius for example 1.5 and 2R (R is the radius i gave to blur in Photoshop), but the result still seems different, i think the result of 2R in BGRA blur, is most simillar blur to R blur for Photoshop! i just wanted to test diiferent R for finding the most matching blur which i couldnt, and i think the difference is in blur algorithms difference in Photoshop and BGRA. any idea??
any help appreciated prior
regards
« Last Edit: July 25, 2016, 09:13:58 am by simin_sh »

circular

  • Hero Member
  • *****
  • Posts: 4467
    • Personal webpage
Re: Topic: Difference between Photoshop and BGRABitmap Blur
« Reply #1 on: July 25, 2016, 12:10:24 pm »
Hello simin_sh

The truth is what is called "gaussian blur" is not exactly what is mathematically defined as a Gaussian function.

In BGRABitmap, the normal blur is in fact rather conic: the importance of neighbor pixels decreases linearly and at the radius it reaches zero. It is called "gaussian blur" in the menu of LazPaint, but that's not really. It is an approximation of it. We could however experiment, trying to generating a true Gaussian blur, and then see how it compares to other blur methods.

In Paint.NET, what is called "gaussian blur" is the fast blur of BGRABitmap. The importance of pixels decreases linearly as well, but both directions are accounted for separately, so it is does not give exactly a rounded shape, something more like a hyperbole. However that's good enough in most causes, and it is available in LazPaint as "fast blur".

A true Gaussian blur in fact does not have a radius, as it is based on the exp function. It has a standard deviation and it is likely that it's what you enter in Photoshop is the standard deviation. Still Photoshop probably does not do an actual Gaussian blur but an approximation of it. I read on a forum that it uses 3 different algorithms depending on the "radius". We could try and compare what Photoshop does with a true Gaussian blur.

So to answer your question specifically, I don't know the algorithm used in Photoshop, but it is worth investigating what a true Gaussian blur does and see how it compares to it, and determine if it is possible to compute it fast enough.

About the radius, as said above, in Photoshop, it is not the radius and probably the standard deviation. We could also compare with a true Gaussian blur to see if it is exactly the standard deviation, the double, half of it, etc. There may be a simple formula indeed like multiplying by a constant to go from one to the other.

I am curious if you can have a better match using the fast blur instead of the conic blur.

Regards
Conscience is the debugger of the mind

Sanem

  • Full Member
  • ***
  • Posts: 179
Re: Topic: Difference between Photoshop and BGRABitmap Blur
« Reply #2 on: July 25, 2016, 01:45:42 pm »
Hi Circular
Thank you so much for your explanation, yep i tested rbFast and the result was much better and more similar,and this is enough for me for now, as you can see in Screenshots, first one is Photoshop blur, second one is BGRA blur, but i used 2.3*R in BGRA (and R in Photoshop).
thank you so much for your help

 

TinyPortal © 2005-2018