diff --git a/src/Intervention/Image/Image.php b/src/Intervention/Image/Image.php index 46e0a135..647e8e53 100644 --- a/src/Intervention/Image/Image.php +++ b/src/Intervention/Image/Image.php @@ -1147,6 +1147,21 @@ class Image return $this; } + /** + * Apply blur filter on the current image + * + * @param integer $amount + * @return Image + */ + public function blur($amount = 1) + { + for ($i=0; $i < intval($amount); $i++) { + imagefilter($this->resource, IMG_FILTER_GAUSSIAN_BLUR); + } + + return $this; + } + /** * Reset to original image resource * diff --git a/tests/ImageTest.php b/tests/ImageTest.php index a84f7b07..28f2c261 100644 --- a/tests/ImageTest.php +++ b/tests/ImageTest.php @@ -1004,6 +1004,14 @@ class ImageTest extends PHPUnit_Framework_Testcase $this->assertEquals('#000000', $img->pickColor(0, 0, 'hex')); } + public function testBlurImage() + { + $img = Image::make('public/tile.png')->blur(); + $this->assertInstanceOf('Intervention\Image\Image', $img); + $this->assertEquals('#b4e000', $img->pickColor(0, 0, 'hex')); + $this->assertEquals('#98bc18', $img->pickColor(0, 7, 'hex')); + } + public function testFillImage() { $img = new Image(null, 32, 32);