(img, threshold)
| 3147 | } |
| 3148 | |
| 3149 | function brightpass(img, threshold) { |
| 3150 | /* Returns a new image where pixels whose luminance fall below the threshold are black. |
| 3151 | */ |
| 3152 | return filter(img, function(p) { |
| 3153 | return (Math.dot(p, LUMINANCE) > ((threshold || threshold == 0)? threshold : 0.5))? p : [0,0,0, p[3]]; |
| 3154 | }); |
| 3155 | } |
| 3156 | |
| 3157 | function blur(img, radius) { |
| 3158 | /* Applies a stack blur filter to the image and returns the blurred image. |