public static function createFilter($filterName)
    {
        $editorName = self::detectAvailableEditor();
        $p = func_get_args();
        if ('Imagick' === $editorName) {
            switch ($filterName){
                case 'Blur':
                    return new ImagickBlur(
                        (array_key_exists(1,$p) ? $p[1] : 1)
                    );
                case 'Brightness':
                    return new ImagickBrightness(
                        $p[1]
                    );
                case 'Colorize':
                    return new ImagickColorize(
                        $p[1], $p[2], $p[3]
                    );
                case 'Contrast':
                    return new ImagickContrast(
                        $p[1]
                    );
                case 'Dither':
                    return new ImagickDither(
                        $p[1]
                    );
                case 'Gamma':
                    return new ImagickGamma(
                        $p[1]
                    );
                case 'Grayscale':
                    return new ImagickGrayscale();
                case 'Invert':
                    return new ImagickInvert();
                case 'Pixelate':
                    return new ImagickPixelate(
                        $p[1]
                    );
                case 'Sharpen':
                    return new ImagickSharpen(
                        $p[1]
                    );
                case 'Sobel':
                    return new ImagickSobel();
            }
            throw new \Exception('Invalid filter name.');
        } else {
            switch ($filterName){
                case 'Blur':
                    return new GdBlur(
                        (array_key_exists(1,$p) ? $p[1] : 1)
                    );
                case 'Brightness':
                    return new GdBrightness(
                        $p[1]
                    );
                case 'Colorize':
                    return new GdColorize(
                        $p[1], $p[2], $p[3]
                    );
                case 'Contrast':
                    return new GdContrast(
                        $p[1]
                    );
                case 'Dither':
                    return new GdDither(
                        $p[1]
                    );
                case 'Gamma':
                    return new GdGamma(
                        $p[1]
                    );
                case 'Grayscale':
                    return new GdGrayscale();
                case 'Invert':
                    return new GdInvert();
                case 'Pixelate':
                    return new GdPixelate(
                        $p[1]
                    );
                case 'Sharpen':
                    return new GdSharpen(
                        $p[1]
                    );
                case 'Sobel':
                    return new GdSobel();
            }
            throw new \Exception('Invalid filter name.');
        }
    }
public static function createFilter($filterName)
    {
        $editorName = self::detectAvailableEditor();
        $p = func_get_args();
        if ('Imagick' === $editorName) {
            switch ($filterName){
                case 'Blur':
                    return new ImagickBlur(
                        (array_key_exists(1,$p) ? $p[1] : 1)
                    );
                case 'Brightness':
                    return new ImagickBrightness(
                        $p[1]
                    );
                case 'Colorize':
                    return new ImagickColorize(
                        $p[1], $p[2], $p[3]
                    );
                case 'Contrast':
                    return new ImagickContrast(
                        $p[1]
                    );
                case 'Dither':
                    return new ImagickDither(
                        $p[1]
                    );
                case 'Gamma':
                    return new ImagickGamma(
                        $p[1]
                    );
                case 'Grayscale':
                    return new ImagickGrayscale();
                case 'Invert':
                    return new ImagickInvert();
                case 'Pixelate':
                    return new ImagickPixelate(
                        $p[1]
                    );
                case 'Sharpen':
                    return new ImagickSharpen(
                        $p[1]
                    );
                case 'Sobel':
                    return new ImagickSobel();
            }
            throw new \Exception('Invalid filter name.');
        } else {
            switch ($filterName){
                case 'Blur':
                    return new GdBlur(
                        (array_key_exists(1,$p) ? $p[1] : 1)
                    );
                case 'Brightness':
                    return new GdBrightness(
                        $p[1]
                    );
                case 'Colorize':
                    return new GdColorize(
                        $p[1], $p[2], $p[3]
                    );
                case 'Contrast':
                    return new GdContrast(
                        $p[1]
                    );
                case 'Dither':
                    return new GdDither(
                        $p[1]
                    );
                case 'Gamma':
                    return new GdGamma(
                        $p[1]
                    );
                case 'Grayscale':
                    return new GdGrayscale();
                case 'Invert':
                    return new GdInvert();
                case 'Pixelate':
                    return new GdPixelate(
                        $p[1]
                    );
                case 'Sharpen':
                    return new GdSharpen(
                        $p[1]
                    );
                case 'Sobel':
                    return new GdSobel();
            }
            throw new \Exception('Invalid filter name.');
        }
    }
public static function createFilter ( $ filterName ) { $ editorName = self :: detectAvailableEditor ( ) ; $ p = func_get_args ( ) ; if ( 'Imagick' === $ editorName ) { switch ( $ filterName ) { case 'Blur' : return new ImagickBlur ( ( array_key_exists ( 1 , $ p ) ? $ p [ 1 ] : 1 ) ) ; case 'Brightness' : return new ImagickBrightness ( $ p [ 1 ] ) ; case 'Colorize' : return new ImagickColorize ( $ p [ 1 ] , $ p [ 2 ] , $ p [ 3 ] ) ; case 'Contrast' : return new ImagickContrast ( $ p [ 1 ] ) ; case 'Dither' : return new ImagickDither ( $ p [ 1 ] ) ; case 'Gamma' : return new ImagickGamma ( $ p [ 1 ] ) ; case 'Grayscale' : return new ImagickGrayscale ( ) ; case 'Invert' : return new ImagickInvert ( ) ; case 'Pixelate' : return new ImagickPixelate ( $ p [ 1 ] ) ; case 'Sharpen' : return new ImagickSharpen ( $ p [ 1 ] ) ; case 'Sobel' : return new ImagickSobel ( ) ; } throw new \ Exception ( 'Invalid filter name.' ) ; } else { switch ( $ filterName ) { case 'Blur' : return new GdBlur ( ( array_key_exists ( 1 , $ p ) ? $ p [ 1 ] : 1 ) ) ; case 'Brightness' : return new GdBrightness ( $ p [ 1 ] ) ; case 'Colorize' : return new GdColorize ( $ p [ 1 ] , $ p [ 2 ] , $ p [ 3 ] ) ; case 'Contrast' : return new GdContrast ( $ p [ 1 ] ) ; case 'Dither' : return new GdDither ( $ p [ 1 ] ) ; case 'Gamma' : return new GdGamma ( $ p [ 1 ] ) ; case 'Grayscale' : return new GdGrayscale ( ) ; case 'Invert' : return new GdInvert ( ) ; case 'Pixelate' : return new GdPixelate ( $ p [ 1 ] ) ; case 'Sharpen' : return new GdSharpen ( $ p [ 1 ] ) ; case 'Sobel' : return new GdSobel ( ) ; } throw new \ Exception ( 'Invalid filter name.' ) ; } }
Create a filter. Detects available editor to use.

@param string $filterName The name of the filter.

@return FilterInterface
@throws \Exception
Create a filter . Detects available editor to use .