Blur an image

Posted on 2009-02-20
Last Modified: 2012-05-06

I need to apply a gaussian blur to an image using PHP, I know that GD and Imagemagick are available on my server.

I'm working with a jpg on the server, let's say example,jpg.

I need to apply the blur to that image and then save it again. It would be great if I could control the level of blur too.

Question by:Mr_Splash
    LVL 16

    Assisted Solution

    Hello Mr_Splash,

    You could phpthumb

    If you look at example 15, you can see the blur process in action


    LVL 3

    Accepted Solution

    Thanks for the replay alain,

    however that method would be very overkill. I've now learnt that PHP5 has a blur function built in that I can simply repeat until I get the desired blur level.

    For anyone else trying this I've put the code below. Change the number of loops to alter the amount of blur.
    for ($x=0; $x<40;$x++) {
      imagefilter($im, IMG_FILTER_GAUSSIAN_BLUR);

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit ( and similar technologies have enjoyed wide adoption, making it possib…
    I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to dynamically set the form action using jQuery.

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now