IMG_FILTER_NEGATE: Reverses all colors of the image. 
IMG_FILTER_GRAYSCALE: Converts the image into grayscale. 
IMG_FILTER_BRIGHTNESS: Changes the brightness of the image. Use arg1 to set the level of brightness. 
IMG_FILTER_CONTRAST: Changes the contrast of the image. Use arg1 to set the level of contrast. 
IMG_FILTER_COLORIZE: Like IMG_FILTER_GRAYSCALE, except you can specify the color. Use arg1, arg2 and arg3 in the form of red, blue, green and arg4 for the alpha channel. The range for each color is 0 to 255. 
IMG_FILTER_EDGEDETECT: Uses edge detection to highlight the edges in the image. 
IMG_FILTER_EMBOSS: Embosses the image. 
IMG_FILTER_GAUSSIAN_BLUR: Blurs the image using the Gaussian method. 
IMG_FILTER_SELECTIVE_BLUR: Blurs the image. 
IMG_FILTER_MEAN_REMOVAL: Uses mean removal to achieve a "sketchy" effect. 
IMG_FILTER_SMOOTH: Makes the image smoother. Use arg1 to set the level of smoothness. 
根据$filtertype不同,可以决定后面带多少参数和起什么作用.

解决方案 »

  1.   

    imagefilter -- 对图像使用过滤器
    说明
    bool imagefilter ( resource src_im, int filtertype [, int arg1 [, int arg2 [, int arg3]]] )
    imagefilter() 把过滤器 filtertype 应用到图像上,在需要时使用 arg1,arg2 和 arg3。 filtertype 可以是下列中的一个: 
    IMG_FILTER_NEGATE:将图像中所有颜色反转。 IMG_FILTER_GRAYSCALE:将图像转换为灰度的。 IMG_FILTER_BRIGHTNESS:改变图像的亮度。用 arg1 设定亮度级别。 IMG_FILTER_CONTRAST:改变图像的对比度。用 arg1 设定对比度级别。 IMG_FILTER_COLORIZE:与 IMG_FILTER_GRAYSCALE 类似,不过可以指定颜色。用 arg1,arg2 和 arg3 分别指定 red,blue 和 green。每种颜色范围是 0 到 255。 IMG_FILTER_EDGEDETECT:用边缘检测来突出图像的边缘。 IMG_FILTER_EMBOSS:使图像浮雕化。 IMG_FILTER_GAUSSIAN_BLUR:用高斯算法模糊图像。 IMG_FILTER_SELECTIVE_BLUR:模糊图像。 IMG_FILTER_MEAN_REMOVAL:用平均移除法来达到轮廓效果。 IMG_FILTER_SMOOTH:使图像更柔滑。用 arg1 设定柔滑级别。 
    注: 本函数仅在 PHP 与其捆绑的 GD 库一起编译时可用。如果成功则返回 TRUE,失败则返回 FALSE。 
    例子 1. imagefilter() 灰度例子<?php
    $im = imagecreatefrompng('dave.png');
    if ($im && imagefilter($im, IMG_FILTER_GRAYSCALE)) {
        echo 'Image converted to grayscale.';
        imagepng($im, 'dave.png');
    } else {
        echo 'Conversion to grayscale failed.';
    }imagedestroy($im);
    ?>