Add blur effect to images in drupal 7? basically I want to add the ability to add a blur effect style to the image styles in Drupal 7.

I tried the imageCache custom action module but I am not able to add own php code since saving any code causes an error. Ive read that people guess the module itself seems to be buggy.

Is there any way I can add my own effect, a function like those listed in image.inc and add that effect to the dropdown?

EDIT:

thanks to the help of Clive I've actually managed to add a blur effect - wicked! :)

Here's the code:

function image_blur_image_effect_info() {

    return array(
        'image_blur' =&gt; array(
            'label' =&gt; t('Gaussian Blur'),
            'help' =&gt; t('Gaussian blur the image by a given amount.'),
            'effect callback' =&gt; 'image_blur_gaussian_blur'
        )
    );
}

function image_blur_gaussian_blur(stdClass $image) {
    $amount = 30;

    for ($i = 0; $i &lt; $amount; $i++) {
        imagefilter($image-&gt;resource, IMG_FILTER_GAUSSIAN_BLUR);
    }

    return imagefilter($image-&gt;resource, IMG_FILTER_GAUSSIAN_BLUR);
}


I just wondered whether this could be done nicer somehow?

Next question: Is it possible to add an input field once the effect is selected sothat the user can type a custom amount of blurriness?

Like so:

function image_blur_gaussian_blur(stdClass $image, $CUSTOMAMOUNT) {
    $amount = $CUSTOMAMOUNT;

    for ($i = 0; $i &lt; $amount; $i++) {
        imagefilter($image-&gt;resource, IMG_FILTER_GAUSSIAN_BLUR);
    }

    return imagefilter($image-&gt;resource, IMG_FILTER_GAUSSIAN_BLUR);
}
Sure, you'll need to write a custom module and implement hook_image_effect_info() to register your effect with the system, e.g.:

function MYMODULE_image_effect_info() {
  return array(
    'mymodule_blur' =&gt; array(
      'label' =&gt; t('Blur'), 
      'help' =&gt; t('Blur an image.'), 
      'effect callback' =&gt; 'mymodule_blur_effect',
    )
  );
}


Then implement your callback function (mymodule_blur_effect()) to manipulate the image. Try following the function trail from image_resize() to get some inspiration on exactly how to access the image stream data.