Create icy avatar images for the winter season It's winter, and the time of year has come for it to start getting cold (and for strange colorful headcloths to start appearing... soon). Let's write some code to make avatar pictures and other images frozen over, to fit the theme!

Input

The input to submissions to this challenge should be an image (the image to make frozen) and a number (the threshold, which will be explained later).

You may input the image in any way your language supports them (a file path or URL as an argument, taking it from the clipboard, dragging and dropping an image, etc.) and in any format listed here that expresses colors in RGB (you can support / require RGBA instead if you want, but this is not a requirement).

You can input the number in any way you would like as well (command line argument, STDIN, input dialog, etc.), with the exception of hardcoding it into your program (ex. n=10). If you use a file path / URL for the image, it must be input in this manner as well.

Output

The program must process the image according to the description below and then output it in any way you would like (to a file, showing it on screen, putting it on the clipboard, etc.).

Description

Submissions should process the image with the following three steps. n refers to the number that your program received as input along with the image.


Apply a blur of radius n to the input image by replacing each pixel's R, G, and B values with the average R, G, and B values of all pixels within a Manhattan distance of n pixels, ignoring all out-of-bounds coordinates. (I.e. all pixels where the sum of the difference in X and the difference in Y is less than or equal to n.)

(note: I used a Gaussian blur for the images above because there was a convenient built-in function for it, so your images might look a little different.)
Set each pixel to a random pixel within a distance of n/2 pixels ("distance" is defined the same way as in the previous step).

This should be done by looping through the image and setting each pixel to a random pixel in this range, so some pixels might disappear entirely and some might be duplicated.

All changes must apply at the same time. In other words, use the old values of the pixels (after step 1 but before this step), not the new values after setting them to a random pixel.
Multiply the "blue" RGB value of each pixel by 1.5, capping it at 255 (or whatever the maximum value for a band of pixels is) and rounding down.


Rules


You may use image libraries / image processing-related functions built into your language; however, you may not use any functions that perform one of the three major tasks mentioned in the description. For example, you can't use a blur function, but a getPixel function is fine.
This is code-golf, so the shortest code in bytes wins!
Python 2 - 326 339 358
Takes input from the user. File first, then n.
from PIL.Image import*;from random import*
a,N=input()
i=open(a)
d=list(i.getdata())
x,y=i.size
R=range(x*y)
m=lambda p,n,r:[p[i]for i in R if abs(n%x-i%x)+abs(n/y-i/y)&lt;=r]
k=d[:]
for p in R:t=map(lambda x:sum(x)/len(x),zip(*m(k,p,N)));d[p]=t[0],t[1],min(255,t[2]*3/2)
i.putdata([choice(m(d,p,N/2))for p in R])
i.save('t.png')

This could probably be golfed much more :P Thanks to @SP3000 for golf ideas!
Sample input:
(Windows)
&quot;C:/Silly/Optimizer/Trix/Are/For/Kids.png&quot;,7

Edit: Bug fixed where blue was being propagated (Martin with n=20 is no longer a river ;_; )
Martin with n=2:

Martin with n=10:

Martin with n=20: