Introduction
Sharp edges are, frankly, just plain dangerous so, given a PNG as input, blur the image using the method described below and blunt those damned sharp edges.
Method
To get the RGB value of each pixel, use the following three equations:
$$R = \sqrt{\frac{1.5\times\sum^n_{a=1}R^2_a}{n}}$$ $$G = \sqrt{\frac{1.5\times\sum^n_{a=1}G^2_a}{n}}$$ $$B = \sqrt{\frac{1.5\times\sum^n_{a=1}B^2_a}{n}}$$
Where \$\sum^n_{a=1}R^2_a\$ is the sum of the red values of each of the adjacent pixels squared. The value of \$n\$ is the number of adjacent pixels (e.g., a corner pixel will have an \$n\$ value of 3, whilst a pixel around the center of the image will have an \$n\$ value of 8).
An adjacent pixel is a pixel which is 1 pixel away from the original pixel in all directions (left, right, up, down and on all of the diagonals).
For example, in the following 3 x 1 image:
The blurred RGB value of the middle pixel will be:
$$R = \sqrt{\frac{1.5*(0^2+0^2)}{2}} = 0$$ $$G = \sqrt{\frac{1.5*(0^2+255^2)}{2}} = 220.836 = 221$$ $$B = \sqrt{\frac{1.5*(255^2+0^2)}{2}} = 220.836 = 221$$
where any decimal outputs are rounded to the nearest unit. You should not simply floor the result.
Therefore, the middle pixel will be the colour (0, 221, 221), or:
Resulting in the image:
You should repeat this process for every pixel in the image. (Note that you do this with the original pixels and not the modified pixels. Basically, you shouldn't overwrite the original image, and should keep it completely separate from the new, blurred image).
If you calculate any values to be greater than 255, assume that its value is 255 (I.e., a value of 374 would be set to 255).
The resulting output should be a separate PNG image (you may name this whatever you wish).
Examples
Super Mario
Original:
Blurred:
Checkerboard
Original:
Blurred:
Crisps
Original
Blurred
Not so crisp anymore
American Gothic
Original:
Blurred:
To see the blur on larger images, it's best to run the program again on the blurred image:
Challenge
The shortest code to blur a given PNG image wins.
You can use image processing libraries (such as PIL) but you must not use built-in blurring functions (Mathematica, I'm looking at you).
Note
As @orlp says below:
For the record, (to my knowledge) this is not a standard blurring method. This challenge is not an educational resource.
n
should appear in the denominator. \$\endgroup\$